Configure an older robot's network
Give a robot with no desktop a new IP address, gateway, and DNS server by writing its network file from the console.
Older robots have no desktop, so you change their IP address from the console, in a short text file.
This page is for robots with no Linux desktop. On a screen, they drop you straight at a command line once you log in. See a desktop instead? Follow configure a robot's network.
Over SSH, every robot gives you a command line. To tell whether yours has a desktop, run:
systemctl is-active NetworkManager
inactive means no desktop, so this page is the right one. active means a desktop: follow configure a robot's network instead.
Before you start
- SSH access to the robot, or a screen and a keyboard if SSH doesn't work. The screen plugs in over HDMI or VGA, depending on the model.
- The robot's credentials. Ask support@kapptivate.com if you don't have them.
- The new IP address, its mask, the gateway, and the DNS server, from your IT team.
- On a filtered corporate network, the flows opened for the new address. The IP requirements document lists them: ask support@kapptivate.com for it. Without those flows, the robot stays Offline on its new address.
Log in
Over SSH, log in with the robot's credentials. Replace USER with the user name and ADDRESS with the robot's current IP address:
ssh USER@ADDRESS
No SSH access? Plug the screen and the keyboard into the back of the robot, then type the user name and the password. Nothing shows while you type the password, and that's expected.
The robot expects an AZERTY keyboard, or a QWERTY one on some robots. Type a at the login prompt. If a q shows up, the robot doesn't receive the keys you press, and that offset holds for the whole page. To check you're typing the password right, type it in the user name field first, where it shows in clear. Then erase it and log in.
Whenever sudo asks for a password on this page, type the one you logged in with.
Find the port
ip -br link | grep ^en
enp1s0 DOWN 00:00:5e:00:53:01 <BROADCAST,MULTICAST>
enp2s0 UP 00:00:5e:00:53:02 <BROADCAST,MULTICAST,UP,LOWER_UP>
The RJ45 network cable sits in the port that shows UP in the second column, enp2s0 here. Write that name down.
No port shows UP? Move the RJ45 cable to another port and run the command again.
Write the new address
You write one or two files with the nano editor. To save and quit, press Ctrl+O, then Enter, then Ctrl+X.
List the robot's network files first.
ls /etc/netplan
If 50-cloud-init.yaml is in the list, the robot puts its old configuration back at every boot. Open this file to stop it:
sudo nano /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
Type these two lines, with two spaces before the second one, then save.
network:
config: disabled
Then move the old configuration aside. It waits in /etc/netplan-backup in case you need to go back to the old address.
sudo mkdir -p /etc/netplan-backup
sudo mv /etc/netplan/*.yaml /etc/netplan-backup/
Now open the new file.
sudo nano /etc/netplan/01-netcfg.yaml
Type the configuration, then save. Indent the lines with the space bar, never with Tab. Here's an example:
network:
ethernets:
enp2s0:
addresses:
- 192.168.10.42/24
gateway4: 192.168.10.1
nameservers:
addresses:
- 192.168.10.53
Each line starts with an exact number of spaces:
| Line | Leading spaces |
|---|---|
network: | 0 |
ethernets: | 2 |
enp2s0: | 4 |
addresses: | 6 |
- 192.168.10.42/24 | 8 |
gateway4: 192.168.10.1 | 6 |
nameservers: | 6 |
addresses: | 8 |
- 192.168.10.53 | 10 |
Swap the sample values for yours:
enp2s0is the port that showedUP.192.168.10.42/24is the new IP address, a slash, then the short form of the mask from the table below.192.168.10.1is the gateway address.192.168.10.53is the DNS server address. With two servers, add a second-line for the other one, with the same 10 spaces in front.
| Mask | Short form |
|---|---|
| 255.255.0.0 | /16 |
| 255.255.240.0 | /20 |
| 255.255.252.0 | /22 |
| 255.255.254.0 | /23 |
| 255.255.255.0 | /24 |
| 255.255.255.128 | /25 |
| 255.255.255.192 | /26 |
| 255.255.255.224 | /27 |
For any other mask, ask your IT team for the short form.
Check the file and reboot
Validate the changes.
sudo netplan generate
A valid file prints nothing, or WARNING lines, which block nothing:
** (generate:1225): WARNING **: 15:24:04.849: Permissions for /etc/netplan/01-netcfg.yaml are too open. Netplan configuration should NOT be accessible by others.
** (generate:1225): WARNING **: 15:24:04.850: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.
An error means a typo in the file. Fix it before you reboot: with an invalid file, the robot boots with no network.
The error names the file, then the line and the column where the typo sits. Reopen the file with sudo nano -l /etc/netplan/01-netcfg.yaml, where -l shows line numbers. Fix the line, save, then run sudo netplan generate again. These are the likely errors.
/etc/netplan/01-netcfg.yaml:4:1: Invalid YAML: tabs are not allowed for indent:
A line starts with a tab. Delete it and use spaces instead.
/etc/netplan/01-netcfg.yaml:6:6: Invalid YAML: inconsistent indentation:
A line starts with the wrong number of spaces. Compare it with the sample.
/etc/netplan/01-netcfg.yaml:7:7: Invalid YAML: could not find expected ':':
A space is missing after a colon, on the line above the one named. A : followed by a value always takes a space after it.
/etc/netplan/01-netcfg.yaml:9:11: Error in network definition: expected sequence
A space is missing after a dash. Every - takes a space after it.
/etc/netplan/01-netcfg.yaml:5:9: Error in network definition: address '192.168.10.42' is missing /prefixlength
The mask is missing after the address. Add /24, or the short form from the table.
Once the check comes back clean, reboot the robot.
sudo reboot
Over SSH, the session drops when the robot reboots. If it comes back with no network, only a screen and a keyboard can get you to go back to the old address.
Give the platform about three minutes, then read the robot's status in your list of robots. It should read Online. Still Offline? Work through checking the robot's network connection.
Go back to the old address
Delete the new configuration, put the old one back, then reboot:
sudo rm /etc/netplan/01-netcfg.yaml
sudo mv /etc/netplan-backup/*.yaml /etc/netplan/
sudo reboot
What's next?
Last updated on