Modify IP, DNS, and route command line settings in linux (1)

Source: Internet
Author: User
Tags nameserver

Set the IP address in the ubuntu command line

Cat/etc/network/interfaces

# This file describes the network interfaces available on your system

# And how to activate them. For more information, see interfaces (5 ).

# The loopback network interface

Auto lo

Iface lo inet loopback

# The primary network interface

Auto eth0

Iface eth0 inet static

Address 192.168.1.104

Netmask 255.255.255.0

Network 192.168.1.0

Broadcast 192.168.1.255

Gateway 192.168.1.2

# Dns-* options are implemented by the resolvconf package, if installed

Dns-nameservers 58.22.96.66 218.104.128.106 202.101.138.8

Dns-search. COM

Restart the NIC:/etc/init. d/networking restatr

Set the IP address in the command line of redhat linux:

Ifconfig eth0 new ip

Then edit/etc/sysconfig/network-scripts/ifcfg-eth0 and modify the ip

1. Modify the IP address

[Aeolus @ database network-scripts] $ vi ifcfg-eth0

DEVICE = eth0

ONBOOT = yes

BOOTPROTO = static

IPADDR = 219.136.241.211

NETMASK = 255.255.255.255.128

GATEWAY = 219.136.241.254

2. Modify the Gateway

Vi/etc/sysconfig/network

NETWORKING = yes

HOSTNAME = Aaron

GATEWAY = 192.168.1.1

3. Modify DNS

[Aeolus @ db etc] $ vi resolv. conf

Nameserver 202.96.128.68

Nameserver 219.136.241.206

4. Restart Network Configuration

/Etc/init. d/network restart

V. Example

1. Modify the IP address

Effective immediately:

# Ifconfig eth0 192.168.0.20 netmask 255.255.255.0

Start effective:

Modify/etc/sysconfig/network-scripts/ifcfg-eth0


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.