Modify IP, DNS, and route settings in linux

Source: Internet
Author: User
Tags nameserver

 

Ifconfig eth0 new ip

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

1. Modify the IP address

[Aeolus @ db1 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 @ db1 etc] $ vi resolv. conf

Nameserver 202.96.128.68

Nameserver 219.136.241.206

 

 

4. Restart the network configuration

/Etc/init. d/network restart

 

Modify IP Address

Effective immediately:

# Ifconfig eth0 192.168.0.20 netmask 255.255.255.0

Start effective:

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

Modify the default gateway

Effective immediately:

# Route add default gw 192.168.0.254

Start effective:

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

Modify dns

Modify/etc/resolv. conf

The modification takes effect immediately and starts as well.

 

Modify host name

Effective immediately:

# Hostname fc2

Start effective:

Modify/etc/sysconfig/network

 

 

Ps:

DEVICE = eth0

BOOTPROTO = static

IPADDR = 192.168.8.85

NETMASK = 255.255.248.0

GATEWAY = 192.168.8.1

HWADDR = 00: 0uu3: 47: 2C: D5: 40

ONBOOT = yes

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.