Go to: set static IP addresses on Ubuntu

Source: Internet
Author: User
Platform: ubuntu12.10 32/64 bit (or ubuntu12.10 installed on the VM)

Cause: assign a fixed IP address as needed. The bird is embarrassed to ask about the network management. You can complete the following steps: graphic interface modification and command line modification. Select either of them.

Note: 1. The premise for modifying a fixed IP address in this article is that the network cable is routed to the PC through the router.

Note: 2. The system running on the VM must use the network in setting to select the bridge link.

 

 

Graphic Interface Modification

1. Open the edit connection In ubuntu (to edit the default link for wireless networks)

2. Change the IPv4 address to "Manual"

3. Add [Plain]View plaincopy
  1. Address: 192.168.1.20
  2. Subnet Mask: 255.255.255.0
  3. Gateway: 192.168.1.1
  4. Preferred DNS server: (DNS of the province and city where Baidu is located, access the router, or directly use 192.168.1.1)
  5. Backup DNS server: 192.168.1.1

4. Check the IPv4 address to complete the connection and save it.

Go online after completing the above steps under startx

 

Command Line Modification (Wireless has not been tried, but regardless of Wired wireless, the system running on the VM is wired)

1. edit the file: [Plain]View plaincopy
  1. $ Sudo VI/etc/NetworkManager. conf
Modify: the value of managed is true.
If it is fault, the system will prompt "the wired network device is not hosted ".

2. Modify the IP settings and edit the file:
[Plain]View plaincopy
  1. $ Sudo VI/etc/Network/interfaces
  2. Auto Lo
  3. Iface lo Inet loopback
  4. Add:
  5. Auto eth0
  6. Iface eth0 Inet static
  7. Address 192.168.1.20
  8. Netmask 255.255.255.0
  9. Gateway 192.168.1.1
Save, so that the IP address does not take effect immediately. Need to execute
$ Sudo/etc/init. d/networking restart
At this time, you can ping the computer in the LAN. But cannot access the Internet because DNS is not set.
 
3. Modify DNS and edit the file: [Plain]View plaincopy
  1. $ Sudo gedit/etc/resolv. conf
  2. Add:
  3. Nameserver (DNS of Baidu's province and city, open the router to view or directly use 192.168.1.1)
  4. Nameserver 192.168.1.1
Save and close,

Restart the NIC to make the settings take effect:

$ Sudo/etc/init. d/networking restart
Use the command line to access the Internet.

 
 
 

Attached Nic settings commands:

[Plain]View plaincopy
  1. View Nic information: ifconfig
  2. Set a nic ip Address: ifconfig eth1 192.168.1.20 netmask 255.255.255.0
  3. Restart the NIC to make the settings take effect: sudo/etc/init. d/networking restart
  4. Change MAC address: ifconfig eth0 HW ether XX: xx
  5. View route information: route-n


Original article: http://blog.csdn.net/saviourxx/article/details/8702821

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.