文档介绍:LINUX下IP及网关配置
ifconfig
# 查看当前系统网卡信息
route
# 查看当前路由信息
sudo ifconfig eth0 down
# 停用网卡eth0
sudo ifconfig eth0 up
# 启用网卡eth0
sudo fig eth0
# 将网卡eth0 和
route stat -r
# 查看路由信息
sudo route add default gw eth0
# 给网卡eth0 设置默认网关
也可以:
sudo vi /etc/work-script/ifcfg-eth0 (redhat)
sudo vi /work/ (Ubuntu)
=========================================================================
:
sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether 00:AA::DD:EE
或者ip link set dev eth0 address 00:01:4f:00:15:f1
sudo ifconfig eth0 up
或者修改配置文件/work/interfaces
在 iface eth0 inet static后添加一行:
pre-up ifconfig eth0 hw ether 00:AA::DD:EE
ip link show eth1 |grep link|awk '{print $2}'
sudo ifconfig eth0 add
或者
sudo ifconfig eth0:0
修改配置文件的方法:
修改/work/interfaces文件,
仿照 eth0的配置,添加个eth0:0的配置,
linux最多支持255个IP别名
(自动协商,全双工/半双工,10M/100M等)
用配置工具mii-tool或者ethtool
只看ethtool的配置方法:
ethtool ethX //查询ethX网口基本设置
ethtool –h //显示ethtool的命令帮助(help)
ethtool -s eth1 autoneg off speed 100 duplex full //关闭自动协商,100M,全双工
重启后配置会丢失
sudo ifconfig eth3 mtu 1000
或者ip link set dev eth0 mtu 1500
或者修改配置文件/work/interfaces
添加
mtu 1492
dhcp方式的要添加
pre-up /sbin/ifconfig $IFACE mtu 1492
/
如何测试MTU:
查看M