Configuring IP Addresses for Hosts to Log In to Devices by Using SSH
Procedure
- Run the npu-smi set -t ssh-enable command to enable the SSH service. For details about how to use the command, see Enabling or Disabling SSH for All Chips and Enabling or Disabling SSH for a Chip.
- Configure the IP address on the host.
The IP address must be in the same network segment as the device IP address, for example, 192.168.1.100. The default IP addresses of devices are in descending order from 192.168.1.199. For example, if there are multiple devices, the IP addresses are 192.168.1.199, 192.168.1.198, 192.168.1.197, and so on. A maximum of 64 devices can be configured.
This section describes how to configure IP addresses only for hosts running Ubuntu 18.04 and CentOS 7.6. For details about how to configure IP addresses for other OSs, see the FAQs at the official OS community website.
- Configure a dynamic IP address for a host running Ubuntu 18.04. (Perform this operation again after each restart.)
- Configure a dynamic IP address:
ifconfig endvnic 192.168.1.100
- Run the ifconfig command to check whether the network configuration is successful.
If the following information is displayed, the network configuration is successful. Otherwise, contact Huawei technical support.
endvnic: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::xxxx:xxxx:xxxx:74d3 prefixlen 64 scopeid 0x20<link> ...
- Configure a dynamic IP address:
- Configure a static IP address for a host running Ubuntu 18.04.
- Modify the YAML configuration file in the /etc/netplan directory.
- Go to the /etc/netplan directory and view the configuration file name:
cd /etc/netplan
ls
The command output is:01-netcfg.yaml
- Open the configuration file:
vi /etc/netplan/01-netcfg.yaml
Add the following information to the file:
endvnic: addresses: [192.168.1.100/24] nameservers: addresses: [255.255.254.0]
Press Esc to switch to the command mode and enter :wq to save the settings and exit.
- Go to the /etc/netplan directory and view the configuration file name:
- Make the network configuration take effect:
netplan apply
- Run the ifconfig command to check whether the network configuration is successful.
If the following information is displayed, the network configuration is successful. Otherwise, contact Huawei technical support.
endvnic: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::xxxx:xxxx:xxxx:74d3 prefixlen 64 scopeid 0x20<link> ...
- Modify the YAML configuration file in the /etc/netplan directory.
- Configure a dynamic IP address for a host running CentOS 7.6. (Perform this operation again after each restart.)
- systemctl status NetworkManager
If the status is not active, run the systemctl start NetworkManager command to start the network manager.
- ifconfig -s endvnic 192.168.1.100
- systemctl disable NetworkManager
- systemctl stop NetworkManager
- systemctl status NetworkManager
- Configure a static IP address for a host running CentOS 7.6. (This operation is not required for each restart.)
- systemctl status NetworkManager
If the status is not active, run the following commands to configure automatic startup:
systemctl start NetworkManager
systemctl enable NetworkManager
- Run nmcli connect add autoconnect no type ethernet con-name endvnic ifname endvnic to generate /etc/sysconfig/network-scripts/ifcfg-endvnic.
- Run the ip a command to check the MAC address.
3: endvnic: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 10:1b:54:xx:xx:d3 brd ff:ff:ff:ff:ff:ff inet 192.168.1.100/24 brd 192.168.1.255 scope global endvnic valid_lft forever preferred_lft forever inet6 fe80::xxxx:xxxx:xxxx:f0d3/64 scope linkifconfig valid_lft forever preferred_lft forever 10:1b:54:xx:xx:d3 is the MAC address.
About the MAC address of a virtual network port
The virtual network port generated after driver installation does not have a fixed MAC address. After the driver is upgraded or installed, a random number is generated as the MAC address. The MAC address is fixed in the format of 10:1b:54:xx:xx:d3, where the fourth and fifth fields are random numbers, and the first three fields (10:1b:54) belong to Huawei.
After the driver is upgraded or installed, the MAC address of the virtual network port changes. You need to bind the MAC address to the IP address again.
- Modify the /etc/sysconfig/network-scripts/ifcfg-endvnic file. (Ensure that the directory has the ifcfg-endvnic file only. Backing up or renaming the file, for example, renaming it as ifcfg-endvnic1, will negatively affect the NIC configuration.)
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no #BOOTPROTO=dhcp # Comment out the line. DEFROUTE=yes #IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=endvnic UUID=6c2db480-1993-40ba-bc21-3541ae728719 DEVICE=endvnic IPADDR=192.168.1.100 # Set to the IP address of the vNIC on the host. ONBOOT=yes HWADDR="10:1b:54:xx:xx:d3" # Set the MAC address of the vNIC. HWADDR indicates the MAC address.
- Run the ifup endvnic command to add an NIC.
- Check whether the network configuration is successful:
ifconfig
If the following information is displayed, the network configuration is successful. Otherwise, contact Huawei technical support.
endvnic: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::xxxx:xxxx:xxxx:78d3 prefixlen 64 scopeid 0x20<link> ether 10:1b:54:xx:xx:d3 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 42 bytes 2940 (2.9 KB) TX errors 8 dropped 8 overruns 0 carrier 0 collisions 0
- systemctl status NetworkManager
- Configure a dynamic IP address for a host running Ubuntu 18.04. (Perform this operation again after each restart.)
- Log in to the device. Log in to the device by running ssh HwHiAiUser@xxx . (xxx indicates the IP address of the device, for example 192.168.1.199.)
- After the device is restarted, the configuration file on the device is restored to the default settings (The default validity period of the account is restored to 90 days). If you need to customize the validity period, you can change the validity period in the /etc/login.defs configuration file. Alternatively, you are advised to add the corresponding chage command to the customized boot script and reconfigure the validity period. For details, see Setting User Account Validity Period.
- Change the password upon the first login to the device. For details about the default username and password, see the Atlas Hardware Product User List. The new passwords must contain at least eight characters, including letters, digits, and special characters (excluding @, % and spaces).