Configure the static IP address in ubuntu. The path of the static IP address is Java code/etc/network/interfaces: www.2cto.com Java code auto eth0 // use the first network adapter iface eth0 inet static // static allocation IP address 172.16.21.234 // IP address gateway 172.16.21.1 // gateway netmask 255.255.255.255.0 // subnet mask network 172.16.21.0 // What do you mean by this? broadcast 172.16.21.255 // broadcast address and restart the network service Java code/etc/init. after configuring d/networking restart, you can connect the Intranet machines of the unified network segment. To connect to the Internet, you also need to configure DNS information. You need to configure the DNS server information in Java code www.2cto.com/etc/resolv. conf. The following example deletes the previous configuration in the file, add the following configuration to the Java code nameserver 172.16.24.12 // enter the actual dns ip address and restart the NIC to make the configuration take effect. Java code/etc/init. d/networking restart has a disadvantage,/etc/resolv. when the conf file is restarted, the system will rewrite the file based on the Information allocated by DHCP,
The previous content will be overwritten. Therefore, this method is temporary. There are many methods on the Internet to prevent/etc/resolv. conf from being overwritten, such as stopping the network service to automatically start at startup.
In fact, they are all incorrect. The specific method still needs to be searched. Author: lichuanbao