Article Title: Modify IP, DNS, and route configurations in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
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 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