Manually configure Ubuntu Linux Series 3-default gateway and host name

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.