查看当前路由及网关信息: [root@localhost ~]# netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 169.254.0.0 * 255.255.0.0 U 0 0 0 eth0 default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
查看物理网卡信息: [root@iyunshusdk ~]# mii-tool [eth0] eth0: negotiated 100baseTx-FD, link ok
ethtool eth0 查看网卡物理信息
ethtool -i eth0 查看网卡驱动信息
ethtool -S eth0 查看网卡工作信息
ifconfig命令:
查看网卡接口信息,默认列出所有接口 [root@localhost ~]# ifconfig 如果想知道主机所有网络接口的情况,请用下面的命令: [root@localhost ~]# ifconfig -aifconfig 网络端口 IP地址 hw <HW> MAC地址 netmask 掩码地址 broadcast 广播地址 [up/down] [root@localhost ~]# ifconfig eth0 10.1.1.10 netmask 255.0.0.0
如果想查看某个端口,比如查看eth0 的状态,就可以用下面的方法: [root@localhost ~]# ifconfig eth0
临时配置网卡信息,无需重启(重启即消失)
临时配置网关 (重启即消失)
[root@localhost ~]# route add default gw 192.168.0.254
网络接口配置文件 (黄色背景最好都设置): [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) TYPE=Ethernet #网卡类型 DEVICE=eth0 #网卡接口名称 ONBOOT=yes #系统启动时是否自动加载 BOOTPROTO=static #启用地址协议 --static:静态协议 --bootp协议 --dhcp协议 IPADDR=192.168.1.11 #网卡IP地址 NETMASK=255.255.255.0 #网卡网络地址 GATEWAY=192.168.1.1 #网卡网关地址 DNS1=10.203.104.41 #网卡DNS地址 HWADDR=00:0C:29:13:5D:74 #网卡设备MAC地址 BROA