previous article on [Original] manual configuration of Ubuntu Linux DHCP client, here again to configure the static IP address method. is still editing the interfaces file. $ sudo vi/etc/network/interfacesThe eth0 configuration is as follows:Auto Eth0Address 192.168.1.123netmask 255.255.255.0Gateway 192.168.1.1 after saving exits, use the restart Networking command to have the new configuration take effect. $ sudo/etc/init.d/networking RestartYou can also restart the network card with the following command, allowing the new configuration to take effect, with the benefit of not affecting other network interfaces. $ sudo ifdown eth0$ sudo ifup eth0If you only want to temporarily change the IP address, you do not have to modify the interface. Use only with ifconfig, but after the system restarts, the system reverts to the configuration in interfaces. $ sudo ifconfig eth0 192.168.1.111 netmask 255.255.255.0similar to the network card IP address setting, there are two ways to set a default gateway in Ubuntu Linux:1. Set in the interfaces file. $ sudo vi/etc/network/interfacesJoin the Gateway 192.168.1.1 in the relevant configuration of eth0, such as:Auto Eth0iface eth0 inet staticAddress 192.168.1.123netmask 255.255.255.0Gateway 192.168.1.1after saving, restart the service. 2. Set directly with the command:Delete the current default gateway$ sudo route del default GWmanually configuring the default gateway$ sudo route add default GW 192.168.1.1Viewing routing information$ routewith this method, the modification takes effect immediately, but after the restart, the settings in the interfaces file are valid. 3. View Host name$ hosts4. Temporarily modify host name$ sudo hostname testserverIt takes effect immediately after the command is executed. 5. Permanently modify the host name$ sudo vi/etc/hostnamewrite the new host name. when the system restarts, the host name in this file is read out
Manually configure Ubuntu Linux Series 3-default gateway and host name