1.安装ethtool软件设置网卡的工作模式
- sudo apt-get install ethtool
概要:
ethtool ethX //查询ethX网口基本设置
ethtool –h //显示ethtool的命令帮助(help)
ethtool –i ethX//查询ethX网口的相关信息
ethtool –d ethX//查询ethX网口注册性信息
ethtool –r ethX//重置ethX网口到自适应模式
ethtool –S ethX//查询ethX网口收发包统计
ethX 是网卡的代表,具体可以用ifconfig命令查看 第一块有线网卡是eth0
这是我电脑设置过的网卡信息
- Settings for eth0:
- Supported ports: [ TP MII ]
- Supported link modes: 10baseT/Half 10baseT/Full
- 100baseT/Half 100baseT/Full
- 1000baseT/Half 1000baseT/Full
- Supported pause frame use: No
- Supports auto-negotiation: Yes
- Advertised link modes:Not reported
- Advertised pause frame use: No
- Advertised auto-negotiation: No
- Speed: 100Mb/s
- Duplex: Full
- Port: MII
- PHYAD: 1
- Transceiver: internal
- Auto-negotiation: off
- Cannot get wake-on-lan settings: Operation not permitted
- Current message level: 0x000020c6 (8390)
- probe link rx_err tx_err hw
- Cannot get link status: Operation not permitted
命令如下
- sudo ethtool -s eth0 autoneg off speed 100 duplex full
3.设置 开机自启动
打开/etc/init.d/rc.local
- sudo vim /etc/init.c/rc.local
- /sbin/ethtool -s eth0 autoneg off speed 100 duplex full