Loading... ifconfig命令时早期网络管理的指令,目前Linux新的发行版本很多默认不带ifconfig命令,但可以以通过安装软件包net-tools方式进行使用. ip命令时新型的网络管理命令,目前基本取代了ifconfig,新的Linux发行版本时一定有ip命令的。 `ifconfig`命令 `ifconfig` 查看当前所有up状态的网卡信息 `ifconfig xxxx `查看xxxx网卡详细信息 `ifconfig eth0 192.168.2.10 netmask 255.255.255.0 broadcast 192.168.2.255 `配置网卡信息 `ifconfig eth0 up` 启动eth0网卡 `ifconfig eth0 down` #关闭eth0网卡 `ifconfig eth0 hw ether AA:AA:BB:CC:dd:EE` 用ifconfig修改网卡eth0MAC地址 `ifconfig eth0 arp` 开启网卡eth0 的arp协议 `ifconfig eth0 -arp` 关闭网卡eth0 的arp协议 ip命令 `ip link show` # 显示网络接口信息 `ip link set eth0 up `# 开启网卡 `ip link set eth0 down` # 关闭网卡 `ip link set eth0 promisc on` # 开启网卡的混合模式 `ip link set eth0 promisc offi` # 关闭网卡的混个模式 `ip link set eth0 txqueuelen 1200` # 设置网卡队列长度 `ip link set eth0 mtu 1400` # 设置网卡最大传输单元 `ip addr show` # 显示网卡IP信息 `ip addr add 192.168.0.1/24 dev eth0` # 设置eth0网卡IP地址192.168.0.1 `ip addr del 192.168.0.1/24 dev eth0` # 删除eth0网卡IP地址 `ip route show` # 显示系统路由 `ip route add default via 192.168.1.254` # 设置系统默认路由 `ip route list` # 查看路由信息 `ip route add 192.168.4.0/24 via 192.168.0.254 dev eth0` # 设置192.168.4.0网段的网关为192.168.0.254,数据走eth0接口 `ip route add default via 192.168.0.254 dev eth0` # 设置默认网关为192.168.0.254 `ip route del 192.168.4.0/24` # 删除192.168.4.0网段的网关 `ip route del default` # 删除默认路由 `ip route delete 192.168.1.0/24 dev eth0` # 删除路由 Last modification:December 16, 2022 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 如果觉得我的文章对你有用,请随意赞赏