# 查看网卡设备:
ifconfig(仅列出up状态)ifconfig -a(包含down状态)
# 开启网卡:
ifconfig up
# 关闭网卡:
ifconfig down
# 配置网卡地址:
ifconfig eth1 add 192.168.101.100 netmask 255.255.255.0 up
ifconfig eth1 192.168.101.2/24
# 配置网卡子接口(虚拟IP):
ifconfig eth1:0 11.11.11.11 netmask 255.255.255.0 up
# 删除网卡子接口:
ifconfig eth1:0 del 11.11.11.11
# 删除网卡地址:
ifconfig eth1 del 192.168.101.100 netmask 255.255.255.0 down
# 修改网卡MAC:
ifconfig eth1 hw ether d0:dd:ca:ba:58:21
ip link set dev eth1 address d0:dd:ca:ba:58:20
# 开启ARP协议:
ifconfig eth1 arp
# 关闭ARP协议:
ifconfig eth1 -arp
ip
# 网卡添加IP:
ip a a 192.168.101.2/24 dev eth1
ip addr add 192.168.101.2/24 dev eth1
# 网卡删除IP:
ip a d 192.168.101.2/24 dev eth1
ip addr del 192.168.101.2/24 dev eth1
# 添加路由:
ip route add 192.168.100.0/24 via 192.168.101.1
# 删除路由:
ip route del 192.168.100.0/24 via 192.168.101.1
# 添加虚拟Vlan接口
ip link add link eth0 name eth0.99 type vlan id 99
# rhel6需要安装vlan(vconfig)和加载8021q模块
vconfig add eth0 100
vconfig set_flag eth0.100 1 1
# 查看虚拟桥是否有vlan
ip -d link show eth0.99
# 删除虚拟接口
ip link delete eth0.99
vconfig rem eth0.100
route
# 添加默认路由:
route add default gw 10.202.1.254
# 删除默认路由:
route del default gw 10.202.1.254
# 添加策略路由:
route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.101.1
# 删除策略路由:
route del -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.101.1
# 添加策略路由设备:
route add -net 192.168.100.0/24 dev eth1
# 删除策略路由设备:
route del -net 192.168.100.0/24 dev eth1