Opensips server construction problem [3] - Ubuntu virtual machine static IP address setting

When the network connection mode of the virtual machine is changed to bridge mode, ifconfig cannot see the IP address of the virtual machine and needs to be manually configured. Other modes can also set the IP to a static IP.

(1) View the gateway address of the virtual machine

#route -n

d1f8acc3d38243738f78562fd2ee782b.png

 (2) Switch to the /etc/netplan/ directory, and set the IP address, gateway address, and DNS address of the physical network card of the virtual machine (make sure it is in the same network segment as the host machine, and the gateway address is set to the routing address of the LAN connected to the computer ). Pay attention to the alignment format of each line, there must be a space after the colon, otherwise an error will occur.

#cd /etc/netplan

#ls

#sudo vim 00-installer-config.yaml

03b82067580a40359e27a69b233dff01.png

You can use the ipconfig/all command in cmd to view the IP address of the DNS server of the wireless LAN connected to the computer.

(3) Make the set IP address take effect

#netplan apply

Restart the virtual machine.

Check whether the virtual machine can connect to the Internet: ping the external network address

e20d00789b734d03b6b3a10d77ab6687.png

 It indicates that the virtual machine is successfully connected to the Internet.

 

 

 

 

Note: It is a study note, if there is any mistake, please correct me.

 

 

Guess you like

Origin blog.csdn.net/m0_51292856/article/details/128349983