Menu

How to set network port IP using command line method

The following methods are applicable to both Type I and Type II virtualization systems

1.Log in to the real-time system of the industrial intelligent computer, full name of iComputer, refer to the documentation.

2.Use the command to view the network port name.

3.Modify the file, enter "i" on the keyboard to edit the file, press "esc" to exit editing, enter ":wq" on the keyboard to save the file

cd /etc/netplan
sudo vim /etc/netplan/01-network-manager-all.yaml   //也可能文件的名字为00-network-manager-all.yaml

4.Set static IP (the number of spaces in each line must be correct)

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    eth0:
      addresses:
          - 192.168.1.200/24

5.Set dynamic IP (the number of spaces in each line must be correct)

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    eth0:
      dhcp4: true

6.Send instructions to make the changed IP effective

sudo netplan apply  

7.If the modified IP address network segment has been changed, the computer should be reconfigured with the same IP as the AI machine, and the modified IP should be checked under the terminal to see if it can be pinged. Please refer to the document-ation.

 

Last modified: 2024-11-14