#ifconfig

配IP的时候学到的一点东西,简单做个记录。

//显示网络设备信息
#ifconfig
enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.101.100.165  netmask 255.255.252.0  broadcast 10.101.103.255
        inet6 fe80::3c77:1895:8f5a:b8fb  prefixlen 64  scopeid 0x20<link>
        ether 48:4d:7e:9d:2c:3f  txqueuelen 1000  (以太网)
        RX packets 609369204  bytes 82446450463 (82.4 GB)
        RX errors 0  dropped 1595230  overruns 0  frame 0
        TX packets 120691044  bytes 38299154001 (38.2 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 19  memory 0xf7000000-f7020000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (本地环回)
        RX packets 959781124  bytes 97628613847 (97.6 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 959781124  bytes 97628613847 (97.6 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

//启动、关闭指定网卡
# ifconfig eth0 down
# ifconfig eth0 up

//为网卡配置和删除IPv6地址
# ifconfig eth0 add 33ffe:3240:800:1005::2/ 64 //为网卡设置IPv6地址
# ifconfig eth0 del 33ffe:3240:800:1005::2/ 64 //为网卡删除IPv6地址

//用ifconfig修改MAC地址
# ifconfig eth0 down //关闭网卡
# ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE //修改MAC地址
# ifconfig eth0 up //启动网卡

//配置IP地址
# ifconfig eth0 192.168.1.56 
//给eth0网卡配置IP地址
# ifconfig eth0 192.168.1.56 netmask 255.255.255.0 
// 给eth0网卡配置IP地址,并加上子掩码
# ifconfig eth0 192.168.1.56 netmask 255.255.255.0 broadcast 192.168.1.255

  • 10
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值