当前位置:Linux教程 - Linux文化 - 指向网络的广播、指向子网的广播和指向超网的广播

指向网络的广播、指向子网的广播和指向超网的广播


>>> 此贴的回复 >> 没有搞懂你说的啥子.. # ifconfig eth1 88.88.88.211 netmask 255.255.255.0 得到inet addr:88.88.88.211 Bcast:88.255.255.255 Mask:255.255.255.0 那广播当然是指向88.255.255.255 而不是你意料中的88.88.88.255 ifconfig在没有指定netmask和broadcast的时候,你指定A类地址,他就给你个A类广播地址,指定B类地址,他就给你个B类广播地址,C类也一样,所以偷懒的ifconfig只有用在配置C类是最合适的.

>>> 此贴的回复 >> ifconfig ethx IP 之后 ifconfig 看到的该 IP 的 netmask 就是根据 RFC 规定的 A/B/C 类地址分配的,同时,广播也是如此 因为 88 在属于 A 地址,因此默认的掩码和广播分别是 255.0.0.0 和 88.255.255.255

>>> 此贴的回复 >> 既然 ifconfig 的时候可以指定 netmask 255.255.255.0,为何不再加一个 broadcast 88.88.88.255 呢? 我的意思是说,默认 netmask 和 broadcast 是根据 RFC 走了,要想改,必须加参数说明

QUOTE: root@PT_LINUX ~# ifconfig eth0 Link encap:Ethernet HWaddr 00:0A:EB:07:22:82 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:23621183 errors:0 dropped:0 overruns:0 frame:0 TX packets:22566916 errors:0 dropped:0 overruns:2 carrier:0 collisions:0 txqueuelen:1000 RX bytes:772487998 (736.7 Mb) TX bytes:4023838170 (3837.4 Mb) Interrupt:9 Base address:0x8c00

eth1 Link encap:Ethernet HWaddr 00:E0:4C:39:6D:96 inet addr:172.25.39.254 Bcast:172.25.39.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:23986925 errors:787 dropped:0 overruns:0 frame:0 TX packets:23273370 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:705667427 (672.9 Mb) TX bytes:503576778 (480.2 Mb) Interrupt:11 Base address:0xa800

lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:1 errors:0 dropped:0 overruns:0 frame:0 TX packets:1 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:112 (112.0 b) TX bytes:112 (112.0 b)

root@PT_LINUX ~# ifconfig eth1:temp 88.88.88.1 netmask 255.255.255.0 broadcast 88.88.88.255 root@PT_LINUX ~# ifconfig eth0 Link encap:Ethernet HWaddr 00:0A:EB:07:22:82 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:23621193 errors:0 dropped:0 overruns:0 frame:0 TX packets:22566926 errors:0 dropped:0 overruns:2 carrier:0 collisions:0 txqueuelen:1000 RX bytes:772491025 (736.7 Mb) TX bytes:4023839522 (3837.4 Mb) Interrupt:9 Base address:0x8c00

eth1 Link encap:Ethernet HWaddr 00:E0:4C:39:6D:96 inet addr:172.25.39.254 Bcast:172.25.39.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:23987069 errors:787 dropped:0 overruns:0 frame:0 TX packets:23273464 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:705682977 (672.9 Mb) TX bytes:503590398 (480.2 Mb) Interrupt:11 Base address:0xa800

eth1:temp Link encap:Ethernet HWaddr 00:E0:4C:39:6D:96 inet addr:88.88.88.1 Bcast:88.88.88.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:77262 errors:0 dropped:0 overruns:0 frame:0 TX packets:98962 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:35281228 (33.6 Mb) TX bytes:93952889 (89.6 Mb) Interrupt:11 Base address:0xa800

lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:1 errors:0 dropped:0 overruns:0 frame:0 TX packets:1 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:112 (112.0 b) TX bytes:112 (112.0 b)

root@PT_LINUX ~#