Configuring the IP configuration command under Ubuntu Linux

Source: Internet
Author: User
Tags nameserver

Transferred from: http://www.2cto.com/os/201306/219381.html

Ubuntu Linux Settings IP configuration command   today installed Ubuntu, but found unable to surf the internet, began to troubleshoot the problem: 1, first determine whether the network connection is correct, the cable used can work 2, check whether the network card can work properly, the method is as follows: A, ping 127.0.0.1b, ping Static gateway address C, ping host name (hostname can see the hostname) 3, see if the network card address is configured correctly (Ifconfig command to see the local Host network card information, and DNS, Default Getway, Sever address to compare, see the network card address is correct) my device problem is in the third aspect, and then modify the network card configuration information, using the command as follows: (of course, the Use of graphics window, I'm just to learn Linux) one, Use the command to set the IP address of Ubuntu 1. Modify the configuration file blacklist.conf disable Ipv6:sudo vi/etc/modprobe.d/blacklist.conf2. Add blacklist ipv6 at the end of the document, Then view the results of the modification: cat/etc/modprobe.d/blacklist.conf3. Set IP (set IP address and subnet mask for NIC eth0) sudo ifconfig eth0 192.168.2.1 netmask 255.255.255.04. Setting the gateway sudo route add default GW 192.168.2.2545. Set the DNS modification/etc/resolv.conf, where you add nameserver DNS address 1 and NameServer DNS Address 2 is complete. 6. Restart the Network service (if not, please restart Ubuntu:sudo reboot): sudo/etc/init.d/networking restart7. View current Ip:ifconfig Second, directly modify the system ubuntu  The Linux profile network Ubuntu Linux profile is:/etc/network/interfaces opens after you set up DHCP or manually set a static IP. Front auto eth0, let the network card boot automatically mount. 1. Configure the NIC in DHCP to edit the file/etc/network/interfaces:sudo vi/etc/network/interfaces and replace the line about eth0 with the following line: # The Primary network Interface-use DHCP to FinD our Addressauto eth0iface eth0 inet DHCP uses the following command to make the network settings effective: sudo/etc/init.d/networking Restart you can also enter the following command directly below the command line to get the address sudo Dhclient eth02. Configure a static IP address for the network card edit the file/etc/network/interfaces:sudo vi/etc/network/interfaces and replace the line about eth0 with the following line: # The Primary network Interfaceauto eth0iface eth0 inet staticaddress 192.168.2.1gateway 192.168.2.254netmask 255.255.255.0#network 192.168.2.0#broadcast 192.168.2.255 Replace the above IP address with your own. Use the following command to make the network settings effective: Sudo/etc/init.d/networking restart3. Set a second IP address (virtual IP address) Edit the file/etc/network/interfaces:sudo vi/etc/network/interfaces add the following line to the file: Auto Eth0:1iface eth0:1 inet staticaddress x.x.x.xnetmask x.x.x.xnetwork x.x.x.xbroadcast x.x.x.xgateway x.x.x.x According to your situation fill in all such as Address,netmask, Information such as Network,broadcast and gateways: Use the following command to make the network settings effective: 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: Sudo/bin/hostname newname when the system starts, it will be from/etc /hostname to read the name of the host. 5. Ubuntu Linux Configuration DNS First, you can add some host names and IP addresses for these host names in/etc/hosts, which is a static query that uses native computers simply. To access the DNS server for querying, you need to set the/Etc/resolv.conf file, assuming that the IP address of the DNS server is 192.168.2.2, then the contents of the/etc/resolv.conf file should be: Search Chotim.comnameserver 192.168.2.26. Restart the Network service manually: Sudo/etc/init.d/networking restart  of course, Ubuntu is a graphical interface, so the above settings for some addresses can also be set to complete the same as Windows, at the top of the window system- >preference to find the appropriate configuration options, in addition, the command line to modify the configuration file with the VI command if the operation is not familiar with the command changes will be inconvenient, so you can choose to use Gedit to edit the configuration file.

Configure commands for IP settings under Ubuntu Linux

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.