从头开始学习ip工具:第一讲 ip ifconfig使用简单对比

ip做为今后要取代ifconfig的工具,其使用第一眼的感觉是比较复杂繁琐,但正因为这个特点,使用上也更详细,我们开个专题来讲一下这些个区别,将使用中的对比拿出来分享一下:
1.查看当前设备网络详情的对比
ifconfig

[root@rk1808:~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:14:97:2E:A5:5E
          inet addr:192.168.2.166  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::214:97ff:fe2e:a55e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3689183 errors:0 dropped:197581 overruns:0 frame:0
          TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:385893384 (368.0 MiB)  TX bytes:3344 (3.2 KiB)
          Interrupt:38

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:11888 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11888 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:879624 (859.0 KiB)  TX bytes:879624 (859.0 KiB)

ip a
[root@rk1808:~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:14:97:2e:a5:5e brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.166/24 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::214:97ff:fe2e:a55e/64 scope link
       valid_lft forever preferred_lft forever
3: mv6390: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether 00:00:00:00:17:5d brd ff:ff:ff:ff:ff:ff
4: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether b0:02:47:3f:c3:79 brd ff:ff:ff:ff:ff:ff

ip addr show  /ip link show与ip a使用上基本一样,在此不再多讲

2.设置ip
ifconfig eth0 down
ifconfig eth0 192.168.1.100 up

ip link set eth0 down
ip addr add 192.168.2.166/24 dev eth0
ip link set eth0 up

3.设置mac地址
[root@rk1808:~]# ifconfig eth0 down
[root@rk1808:~]# ifconfig eth0 hw ether 00:25:5E:08:DE:43
[root@rk1808:~]# ifconfig eth0 up


root@astrol:~# ip link set eth0 down  
root@astrol:~# ip link set eth0 address 00:0c:29:0d:ce:95  
root@astrol:~# ip link set eth0 up  

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值