Linux network settings

Source: Internet
Author: User
1. modify ip address, Gateway sudovi/etc/network/interfaces # Theloopbacknetworkinterfaceautoloifaceloinetloopback # Theprimarynetworkinterfaceautoeth0 # eth0use...

1. modify the ip address and Gateway
Sudo vi/etc/network/interfaces
======================================
# The loopback network interface
Auto lo
Iface lo inet loopback

# The primary network interface
Auto eth0

# Eth0 use dhcp
# Iface eth0 inet dhcp

# Eth0 use static
Iface eth0 inet static
Address 172.20.35.21
Netmask 255.255.255.0
Gateway 172.000034.254
======================================

2. modify DNS
Sudo vi/etc/resolv. conf
======================================
Nameserver 58.22.96.66
Nameserver 210.34.48.34
Domain localdomain
Search localdomain
======================================

3. restart the network
Sudo/etc/init. d/networking restart

4. if an error occurs when the network service is restarted
$ Sudo service networking restart
SIOCSIFADDR: No such device eth0
This is because the udev service records the Nic attributes in the local file during system installation. after cloning, the new device is inconsistent with the original storage, so it cannot be started.
Solution: delete the local file and restart the operating system to regenerate the file.
# Ubuntu
Sudo mv/etc/udev/rules. d/70-persistent-net.rules/etc/udev/rules. d/70-persistent-net.rules.old
# Debian
Sudo mv/etc/udev/rules. d/z25_persistent-net.rules/etc/udev/rules. d/z25_persistent



Author hpwzd

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.