与ethtool相关的命令要先下载ethtool工具。
netstat -r //查看路由表
ifconfig //查看所有端口的配置 ethtool enp2s0 //查看网络端口的详细信息sudo /etc/init.d/networking restart //重启网络服务,配置完成后重启才能生效
A以下为临时设置×××××××××××××××××××××××××××××× //调整速度 sudo ethtool -s enp2s0 autoneg off speed 10 duplex full //设置ip,掩码 sudo ifconfig enp2s0 219.216.xxx.xxx netmask 255.255.255.0 up 设置网关 sudo route add default gw 219.216.xxx.xxx // DNS sudo vi /etc/resolv.conf search chotim.comnameserver 202.118.66.6
B永久设置×××××××××××××××××××××××××××× 1,永久ip设置sudo gedit /etc/network/interfaces 静态ip无法链接无线网,和DNS无关 静态ip auto enp2s0 iface enp2s0 inet static address 219.216.xxx.xxx netmask 255.255.255.0 gateway 219.216.xxx.xxx 动态ip auto enp2s0 iface enp2s0 inet dhcp 2, 永久DNS设置sudo gedit /etc/resolvconf/resolv.conf.d/base只要添加DNS地址即可
nameserver 202.118.66.6
修改过永久DNS后不行,就查看临时DNS是否修改
sudo vi /etc/resolv.confnameserver: xxxxxxxxx
执行下面两个命令,启用新设置
$sudo ifdown enp2s0 $sudo ifup enp2s03,永久速度(暂时没找到,只能把命令添加到启动脚本中/etc/rc.local )
sudo ethtool -s enp2s0 autoneg off speed 100 duplex full意思:有线网卡enp2s0 关闭自动协商,全双工,速度100。
