常用网络工具

ifconfig

# 查看网卡设备:
ifconfig(仅列出up状态)ifconfig -a(包含down状态)

# 开启网卡:
ifconfig up

# 关闭网卡:
ifconfig down

# 配置网卡地址:
ifconfig eth1 add 192.168.101.100 netmask 255.255.255.0 up
ifconfig eth1 192.168.101.2/24

# 配置网卡子接口(虚拟IP):
ifconfig eth1:0 11.11.11.11 netmask 255.255.255.0 up

# 删除网卡子接口:
ifconfig eth1:0 del 11.11.11.11

# 删除网卡地址:
ifconfig eth1 del 192.168.101.100 netmask 255.255.255.0 down

# 修改网卡MAC:
ifconfig eth1 hw ether d0:dd:ca:ba:58:21
ip link set dev eth1 address d0:dd:ca:ba:58:20

# 开启ARP协议:
ifconfig eth1 arp

# 关闭ARP协议:
ifconfig eth1 -arp

ip

# 网卡添加IP:
ip a a 192.168.101.2/24 dev eth1	
ip addr add 192.168.101.2/24 dev eth1

# 网卡删除IP:
ip a d 192.168.101.2/24 dev eth1
ip addr del 192.168.101.2/24 dev eth1

# 添加路由:
ip route add 192.168.100.0/24 via 192.168.101.1

# 删除路由:
ip route del 192.168.100.0/24 via 192.168.101.1

# 添加虚拟Vlan接口
ip link add link eth0 name eth0.99 type vlan id 99

# rhel6需要安装vlan(vconfig)和加载8021q模块
vconfig add eth0 100
vconfig set_flag eth0.100 1 1

# 查看虚拟桥是否有vlan
ip -d link show eth0.99

# 删除虚拟接口
ip link delete eth0.99
vconfig rem eth0.100

route

 # 添加默认路由:
 route add default gw 10.202.1.254
 
# 删除默认路由:
route del default gw 10.202.1.254

# 添加策略路由:
route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.101.1

# 删除策略路由:
route del -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.101.1

# 添加策略路由设备:
route add -net 192.168.100.0/24 dev eth1

# 删除策略路由设备:
route del -net 192.168.100.0/24 dev eth1

ethtool

  1. 查询网卡基本设置:ethtool enp5s0在这里插入图片描述
  2. 设置网卡速率、半/全双工、是否自协商
ethtool –s enp5s0 [speed 10|100|1000] [duplex half|full]  [autoneg on|off]
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值