Modify IP, Mac, DNS, and gate in Ubuntu

Source: Internet
Author: User
Tags nameserver

In many cases, we need to modify the IP address, DNS, and other content. If it is a dynamic modification, We need to reset it after the computer is started, which is very troublesome, A lot of online information can not really achieve permanent modification, or even wrong, here will be the correct settings of the Content shared to everyone to learn, if there is reprint please note the Source: Unknown blog http://qinjiana0786.cublog.cn, my personal book "tracking Linux TCP/IP code running" will be published by Beihang publishing house in middle April, hoping to help friends who love the Internet. The following content is set on Ubuntu, which is also valid for other Linux systems.

Sudo ifconfig eth0 down

Sudo ifconfig eth0 HW ether XX: xx

Sudo ifconfig eth0 192.168.x.x netmask 255.255.255.0

Sudo ifconfig eth0 up

After this modification, if the computer is restarted, the pre-modification settings will be restored.

If it is a permanent modification, You need to modify the file to implement it.

Sudo gedit/etc/Network/interfaces

The content is as follows. Note that the content in the brackets is not input to the file.

Auto Lo
Iface lo Inet loopback
Auto eth0
Iface eth0 Inet static
Hwaddress ether XX: XX (here is the MAC address to be set)
Address 192.168.x.x (the IP address to be set here)
Netmask 255.255.255.0
Gateway 192.168.x.x (the gateway to be set here)
Nameserver x. x (DNS here)
It may be reported that/etc/resolv. conf cannot be found, and DNS can be set to this file.
Sudo gedit/etc/resolv. conf
Nameserver x. x (DNS here)
Then run the restart command:
Sudo/etc/init. RD/networking restart
Since then, the restart has been permanently modified.

If you want to save the Internet cost, you can use the above method to share a network cable with your friends without having to pay high Internet fees on your own. You can use a router to clone the Internet when you bind a Mac, at present, the RJ45 network port on the market (only one dollar for online sales) of vrouters is saved if it is feasible, but unfortunately I have not tried it, if you have tried it, you can leave a message. To clone the internet, you must copy the IP/MAC/DNS/gate content through sudo ifconfig-A on the internet server, after modifying the content above, you can break through the limitations of binding to the Internet. Of course, this article is not for this purpose, but if it happens to help readers, it is also a blessing, in order to combat companies and individuals who obtain profits through Internet access fees. If you have reproduced please indicate the source: Unknown blog http://qinjiana0786.cublog.cn.

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.