First, view the current machine Nic IP1 display the currently started network interface command: ifconfig2 view all current network interface command: ifconfig-a3 view the specified network interface command: ifconfigeth0 IP address modification in LINUX is divided into two situations, 1 modified during debugging
First, check the IP address of the NIC of the current machine.
1. display the currently started network interface commands:
Ifconfig
2. View all current network interface commands:
Ifconfig-
3. view the specified network interface command:
Ifconfig eth0
IP address modification in LINUX is divided into two situations,
1. modify the IP address during debugging. it takes effect only for the moment. after restart, it is restored to the original IP address.
Ifconfig eth0 192.168.63.27 netmask 255.255.255.0 route add defaultgw 192.168.63.1 up
2. it will take effect permanently (that is, it will take effect after restart)
Method 1: configure the Nic configuration file
Modify/etc/sysconfig/network-scripts/ifcfg-eth0
Vi/etc/sysconfig/network-scripts/ifcfg-eth0 # Second Nic: vi/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE = eth0 # physical DEVICE name
IPADDR = 192.168.1.10 # IP address
NETMASK = 255.255.255.0 # mask value
NETWORK = 192.168.1.0 # NETWORK address (optional)
BROADCAST = 192.168.1.255 # BROADCAST address (optional)
GATEWAY = 192.168.1.1 # GATEWAY address
ONBOOT = yes # [yes | no] (whether to activate the device during boot)
USERCTL = no # [yes | no] (whether non-root users can control the device)
BOOTPROTO = static # [none | static | bootp | dhcp] (no protocol used during boot | static allocation | BOOTP protocol | DHCP protocol)
Restart the service network restart to take effect, or/etc/init. d/networkrestart to take effect.
Method 2:
Save ifconfig eth0 192.168.63.27 netmask 255.255.255.0 route adddefault gw 192.168.63.1 to the/etc/init. d/rc. local file.