Configure the IP address in UbuntuLinux

Source: Internet
Author: User
Ubuntu is installed in the configuration command for setting IP addresses under UbuntuLinux. However, if you find that you cannot access the Internet, troubleshoot the problem: 1. check whether the network connection is correct, the network cable used can work normally. 2. check whether the network adapter works properly. the method for detecting the network adapter is as follows: a, ping127.0.0.1b... in Ubuntu Linux, the IP address configuration command is installed with Ubuntu today. However, if you find that you cannot access the Internet, you must first check whether the network connection is correct, check whether the network cable used works normally. 2. check whether the network card works properly. the detection method is as follows: a. ping 127.0.0.1b, ping static gateway address c, ping host name (hostname can be seen) 3. check whether the Nic address is configured correctly (ifconfig command to view the Nic information of the local host, compare with DNS, Default getway, and Sever addresses to see if the Nic address is correct.) my device has a problem with the third aspect, and then modify the Nic configuration information, run the following command: (of course, you can use the graphic window. I. use commands to set the IP address of ubuntu. modify the configuration file blacklist. conf disable IPV6: sudo vi/etc/modprobe. d/blacklist. conf2. add blacklist ipv6 at the end of the document and view the modification result: cat/etc/modprobe. d/blacklist. conf3. set the IP address (set the IP address and subnet mask of the network adapter eth0) sudo ifconfig eth0 192.168.2.1 netmask 255.255.255.04. set the Gateway sudo route add default gw 192.168.2.2545. set DNS modification/etc/resolv. conf. add the address 1 of nameserver DNS and address 2 of nameserver DNS. 6. restart the network service (if not, restart ubuntu: sudo reboot): sudo/etc/init. d/networking restart7. view the current IP address: ifconfig 2. directly modify the Ubuntu Linux configuration file. The network Ubuntu Linux configuration file is: after/etc/network/interfaces is enabled, you can set DHCP or manually set static IP addresses. In front of auto eth0, enable automatic Nic mounting. 1. configure the NIC in DHCP mode to edit the file/etc/network/interfaces: sudo vi/etc/network/interfaces and replace the eth0 row with the following line: # The primary network interface-use DHCP to find our addressauto eth0iface eth0 inet dhcp use The following command to make The network settings take effect: sudo/etc/init. d/networking restart can also directly enter the following command under the command line to obtain the address sudo dhclient eth02. configure the static IP address for the NIC to edit the file/etc/network/interfaces: sudo vi/etc/network/interfaces replace The eth0 row with The following row: # The primary network interfaceauto eth 0 iface eth0 inet staticaddress 192.168.2.1gateway 192.168.2.254netmask 255.255.255.255.0 # network 192.168.2.0 # broadcast 192.168.2.255 replace the above IP address and other information with your own. run the following command to make the network settings take effect: sudo/etc/init. d/networking restart3. set the second IP address (Virtual IP address). edit the file/etc/network/interfaces: sudo vi/etc/network/interfaces and add the following lines to the file: auto eth0: 1 iface eth0: 1 inet staticaddress x. x. x. xnetmask x. x. x. xnetwork x. x. x. xbroadcast x. x. x. xgateway x. x. x. X fill in all information such as address, netmask, network, broadcast, and gateways according to your situation: Use the following command to make the network settings take effect: sudo/etc/init. d/networking restart4. set host name (hostname) use the following command to view the host name of the current host: sudo/bin/hostname use the following command to set the host name of the current host: when the sudo/bin/hostname newname system is started, it reads the host name from/etc/hostname. 5. configure DNS in Ubuntu Linux. First, you can add some IP addresses corresponding to these host names to/etc/hosts. this is a simple static query on the local machine. To access the DNS server for query, you need to set/etc/resolv. conf file. if the IP address of the DNS server is 192.168.2.2,/etc/resolv. the content of the conf file should be: search chotim. comnameserver 192.168.2.26. manually restart the network service: sudo/etc/init. d/networking restart of course, ubuntu has a graphical interface, so the above settings on some addresses can also be completed by setting like windows, find the corresponding configuration options under System-> Preference in the upper part of the window. In addition, it is inconvenient to modify the vi command when you use the command line to modify the configuration file, therefore, you can select gedit to edit the configuration file.

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.