Set a fixed IP address in ubuntu linux (applicable to both PC and virtual machines)

Source: Internet
Author: User
Tags nameserver

Set a fixed IP address in ubuntu linux (applicable to both PC and virtual machines) 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: graphical interface modification and command line modification. You can choose either of them. Note: 1. The premise of modifying a fixed IP address in this article is: note: 2. the system running on the VM must use the Network selection bridge link in Setting to modify the graphical interface 1. Open the edit connection In ubuntu (the default link should be edited for wireless networks) 2. Change the IPv4 address to "Manual" 3. Add the [plain] address: 192.168.1.20 subnet mask: 255.255.255.0 Gateway: 192.168.1.1 preferred DNS server: (DNS of the province and city where Baidu is located, open the router to view or directly use 192.168.1.1) backup DNS server: 192.168.1.1 4. Check the IPv4 address to complete the connection and save it. After completing the above steps under StartX, you can access the Internet by using the command line (Wireless has not been tried, but regardless of Wired wireless, the system running on the VM is wired) 1. edit the file: [plain] $ sudo vi/etc/NetworkManager. conf modification: The managed parameter is true. If it is fault, a message saying "the wired network device is not hosted ". 2. Modify the IP settings and edit the file [plain] $ sudo vi/etc/network/interfaces auto lo iface lo inet loopback: auto eth0 iface eth0 inet static address 192.168.1.20 netmask 255.255.255.0 gateway 192.168.1.1 save, so that the IP address does not take effect immediately. Run $ sudo/etc/init. d/networking restart to ping the computer on the LAN. But cannot access the Internet because DNS is not set. 3. Modify DNS and edit the file: [plain] $ sudo gedit/etc/resolv. add conf: nameserver (DNS of Baidu's province and city, open vro to view or directly use 192.168.1.1) nameserver 192.168.1.1 save and close. Restart the NIC to make the settings take effect: $ sudo/etc/init. d/networking restart command line to complete the above steps, you can access the Internet with the NIC settings related commands: [plain] to view the NIC information: ifconfig to set a nic ip: ifconfig eth1 192.168.1.20 netmask restart 255.255.0 restart the NIC to make the settings take effect: sudo/etc/init. d/networking restart change MAC address: ifconfig eth0 hw ether xx: xx view route information: route-n

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.