Modify IP, DNS and other network configurations under Linux operating system

  

Modify IP, DNS and routing configuration under Linux operating system


ifconfig eth0 new ip

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

First, 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.128

GATEWAY= 219.136.241.254

Second, modify the gateway

vi /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=Aaron

GATEWAY=192.168.1.1

Third, modify DNS

[aeolus@db1 etc]$ vi resolv.conf

nameserver 202.96.128.68

nameserver 219.136 .241.206

Fourth, restart the network configuration

/etc/init.d/network restart

Modify the IP address

Effective immediately:

# ifconfig eth0 192.168.0.20 netmask 255.255.255.0

Startup:

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

Modify default gateway

Effective immediately:< Br>

# route add default gw 192.168.0.254

Startup:

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

Modify dns< Br>

Modify /etc/resolv.conf

It can be effective immediately after modification, and the startup is also valid

Modify host name

Effective immediately:

# hostname fc2

Startup Effective:

Modify /etc/sysconfig/network

Copyright © Windows knowledge All Rights Reserved