Ubuntu config and modify IP address

Source: Internet
Author: User
Tags vcard nameserver dmesg

http://blog.csdn.net/readiay/article/details/50866709

Ubuntu config and modify IP address


1. Modify the configuration file/etc/network/interfaces
[Email protected]:~# sudo gedit/etc/network/interfaces


Add the following content:
Auto Eth0 #设置自动启动eth0接口
Iface eth0 inet Static #配置静态IP
Address 192.168.11.88 #IP地址
netmask 255.255.255.0 #子网掩码
Gateway 192.168.11.1 #默认网关


2. Modify DNS
sudo gedit/etc/resolve.conf
NameServer 8.8.8.8 #当地dns服务器 (view local DNS with Ipconfig/all, first DNS is default, Total 2 DNS)


The DNS changes here after the restart of the computer has disappeared, to be permanently effective need to make the following configuration:


sudo vi/etc/resolvconf/resolv.conf.d/base

In the open file, add

NameServer 202.103.224.68
NameServer 202.103.225.68



Note: #后面的注释信息不要加进去.


3. Restart the network for the configuration to take effect
sudo/etc/init.d/networking restart


4. See if IP is configured successfully [email protected]:~# ifconfig
Eth0 Link encap:ethernet HWaddr 00:0c:29:2d:89:40
inet addr:192.168.11.88 bcast:192.168.11.255 mask:255.255.255.0
Inet6 ADDR:FE80::20C:29FF:FE2D:8940/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:223 errors:0 dropped:0 overruns:0 frame:0
TX packets:253 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:24219 (24.2 KB) TX bytes:22960 (22.9 KB)
Interrupt:19 Base address:0x2024


Lo Link encap:local Loopback
inet addr:127.0.0.1 mask:255.0.0.0
Inet6 addr::: 1/128 scope:host
Up LOOPBACK RUNNING mtu:16436 metric:1
RX packets:48 errors:0 dropped:0 overruns:0 frame:0
TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3964 (3.9 kb) TX bytes:3964 (3.9 kb)


[Email protected]:~#


Note: The red word bold "192.168.11.88" is the same as the IP configured above, indicating that the IP configuration was successful.

You're here : Home →linux →how to ' s →ubuntu → change default network name (ENS33) To old "eth0" on Ubuntu 16.04 Change default network Name (ENS33) to old "eth0" on Ubuntu 16.04 Raj March, Comments ubuntu 16.04

Change default network Name (ENS33) to old "eth0" on Ubuntu 16.04

Just after the Ubuntu 16.04 installation, I came to know so the network interface name got changed to Ens33 from Old Sch Ool eth0. If you ever interested in changing interface names to old type EthX.

As you can see in the following command, my system was having a network adapter called ENS33.

Note:this is just the case of VMware environment, it may vary depends on the hardware and the steps to get back EthX would Be the same.

$ IP a1:lo: <loopback,up,lower_up> MTU 65536 qdisc noqueue State UNKNOWN Group default Qlen 1 Link/loopback 00:0 0:00:00:00:00 BRD 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft Forever ine T6:: 1/128 scope host Valid_lft forever Preferred_lft Forever2: ens33: <broadcast,multicast,up,lower_up> MTU Qdisc pfifo_fast State up group default Qlen 1000 Link/ether 00:0c:29:05:a3:e2 BRD ff:ff:ff:ff:ff:ff inet 192.168.12.12/24 BRD 192.168.12.255 scope global dynamic EN S33 valid_lft 1683sec preferred_lft 1683sec inet6 fe80::20c:29ff:fe05:a3e2/64 scope link Valid_lft for Ever Preferred_lft forever

From the DMESG command, you can see that the device got renamed during the system boot.

$ DMESG | Grep-i eth[3.050064] e1000 0000:02:01.0 eth0: (pci:66mhz:32-bit) 00:0c:29:05:a3:e2[3.050074] e1000 0000:02:01.0 E Th0:intel (R) pro/1000 Network connection[3.057410] e1000 0000:02:01.0 ens33:renamed from eth0

To get a ethX back, edit the grub file.

$ sudo nano/etc/default/grub

Look for "grub_cmdline_linux" and add the following "net.ifnames=0 biosdevname=0".

From:

Grub_cmdline_linux= ""

To:

grub_cmdline_linux= "net.ifnames=0 biosdevname=0"

Generate a new grub file using the following command.

$ sudo grub-mkconfig-o/boot/grub/grub.cfggenerating grub configuration file ... Warning:setting grub_timeout to a Non-zero value when grub_hidden_timeout are set is no longer supported. Found Linux Image:/boot/vmlinuz-4.4.0-15-genericfound initrd Image:/boot/initrd.img-4.4.0-15-genericfound memtest86 + Image:/memtest86+.elffound memtest86+ Image:/memtest86+.bindone

Edit the interface file and the network device name so, you'll have a static IP address for EthX.

If your network card is DHCP enabled, you can skip the below step

$ sudo nano/etc/network/interfaces

From:

Ens33  ens33 inet static address 192.168.12.12 netmask 255.255.255.0 dns-nameservers 1 92.168.12.2 Gateway 192.168.12.2

To:

eth0  eth0 inet static address 192.168.12.12 netmask 255.255.255.0 dns-nameservers 19 2.168.12.2 Gateway 192.168.12.2

Reboot your system.

$ sudo reboot

After the system reboot, just check whether you have a ethX back.

$ IP a1:lo: <loopback,up,lower_up> MTU 65536 qdisc noqueue State UNKNOWN Group default Qlen 1    Lin K/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00    inet 127.0.0.1/8 Scope host lo   & nbsp;   Valid_lft Forever Preferred_lft forever    Inet6:: 1/128 scope host         Valid_lft Forever Preferred_lft forever2: eth0: <broadcast,multicast,up,lower_up> MTU Qdisc pfifo_fast State up group default Qlen Ink/ether 00:0c:29:05:a3:e2 BRD ff:ff:ff:ff:ff:ff  inet 192.168.12.12/24 BRD 192.168.12.255 Scope Global eth0 Valid_lft Forever Preferred_lft forever inet6 fe80::20c:29ff:fe05:a3e2/64 scope link Valid_lft forever p Referred_lft Forever 

That's all, drop your thoughts in the comments section.

Ubuntu config and modify IP address

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.