Set IP address, Gateway, DNS in Debian

Source: Internet
Author: User
Tags nameserver

1. Set IP address, gateway


Cp/etc/network/interfaces/etc/network/interfaces.bak # Backing up legacy configuration Files


Vi/etc/network/interfaces # Edit Network adapter profile

# The Loopback network interface
Auto Lo
Iface Lo inet Loopback

# The Primary network interface
Auto eth0 # Auto Connect network
Allow-hotplug eth0
Iface eth0 inet Static # static means using dynamic IP with fixed ip,dhcp representations
Address 192.168.21.166 # set IP address
netmask 255.255.255.0 # Set Subnet mask
Gateway 192.168.21.2 # Setting up gateways

Press the ESC key, and then enter: EQ to save and exit.

The following version is easy to copy because it is best not to have Chinese in the configuration file:

# The Loopback network interface
Auto Lo
Iface Lo inet Loopback

# The Primary network interface
Auto Eth0
Allow-hotplug eth0
Iface eth0 inet Static
Address 192.168.21.166
Netmask 255.255.255.0
Gateway 192.168.21.1


2. Set up DNS


Cp/etc/resolv.conf/etc/resolv.conf.bak # Backing up the original DNS configuration file


Vi/etc/resolv.conf # Edit configuration file


NameServer 127.0.0.1
NameServer 8.8.8.8 # Setting Preferred DNS
NameServer 8.8.4.4 # Setting up alternate DNS

Press the ESC key, and then enter: EQ to save and exit.

The following version is easy to copy because it is best not to have Chinese in the configuration file:

NameServer 127.0.0.1
NameServer 8.8.8.8
NameServer 8.8.4.4


3. Restart the network


Service Networking Restart # Restart Network


At this point, the IP address, gateway, DNS configuration is complete, now the system is ready to go online.

Set IP address, Gateway, DNS in Debian

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.