linux下的lan、网口、Ethernet通信

2025-05-23 18:08:09

1、首先我们关闭网络接口。 # ifconfig eth0 inet down # ifconfig lo Link encap:Local Loopback ... (没有 eth0 这个条目了) # route ... (没有路由表了)

2、接下来我们启动 eth0 并给予其新的 IP 地址和路由。 # ifconfig eth0 inet up 192.168.0.111 \ netmask 255.255.255.0 broadcast 192.168.0.255 # route add -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.0.1 dev eth0

3、结果是: # ifconfig eth0 Link encap:Ethernet HWaddr 08多唉捋胝:00:46:7A:02:B0 inet addr:192.168.0.111 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 ... lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 ... # route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.0.0 * 255.255.255.0 U 0 0 0 eth0 10.0.0.0 192.168.0.1 255.0.0.0 UG 0 0 0 eth0

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢