To modify the network card command:
Ifconfig eth0 192.168.0.3 netmask 255.255.255.0
⚠️ temporarily modify IP effective, if you want to restart after still effective, you can modify the network card configuration file.
To reboot the network card command:
CentOS: sudo service network restart
Ubuntu: sudo/etc/init.d/networking restart
NIC configuration file: CentOS: Modifying/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0 #网卡对应的设备别名
bootproto=static #网卡获得ip地址的方式 (defaults to DHCP for automatic acquisition)
HWADDR=00:07:E9:05:E8:B4 # Nic MAC address (Physical address)
ipaddr=192.168.100.100 #IP地址
netmask=255.255.255.0 #子网掩码
onboot=yes #系统启动时是否激活此设备
Ubuntu: Modify/etc/network/interfaces
Auto eth0
iface eth0 inet static address
192.168.3.90
Gateway 192.168.3.1
netmask 255.255.255.0
Modify DNS
# vi/etc/resolv.conf
nameserver 8.8.8.8 #google域名服务器
nameserver 114.144.114.114 #国内域名服务器
Ubuntu Reference: http://www.linuxidc.com/Linux/2013-04/83577.htm
CentOS Reference: http://www.linuxidc.com/Linux/2015-02/112964.htm