网络协议和管理配置及网络常用命令

网络协议和管理配置

三种通讯模式
单播
广播
组播

冲突域:俩个网络设备同时发送数据,如果发生了冲突,则俩个设备处于同一个冲突域,反之则各自处于不同的冲突域
广播域:一个网络设备发送广播,另一个设备收到了,则俩个设备处于同一个广播域,反之则处于不同的广播域

单工通信:只有一个方向通信
半双工通信:通信双方都可以发送和接收信息,但不能同时发送,也不能同时接收
全双工通信:通信双方可以同时发送和同时接收

查看双工速度
mii-tool eth0
mii-tool -v eth0

ethtool -i eth0
ethtool eth0

ip link

查看和调整动态端口范围
#cat /proc/sys/net/ipv4/ip_local_port_range
32768 60999
echo 20000 62000 > /proc/sys/net/ipv4/ip_local_port_range

nc命令可以开启端口测试
#nc -l 22
Ncat: bind to :::22: Address already in use. QUITTING.

arp表查询
[19:32:11 root@localhost ~]#ip neigh
10.0.0.2 dev eth0 lladdr 00:50:56:fa:52:36 STALE
10.0.0.1 dev eth0 lladdr 00:50:56:c0:00:08 DELAY
[19:37:30 root@localhost ~]#arp -n
Address HWtype HWaddress Flags Mask Iface
10.0.0.2 ether 00:50:56:fa:52:36 C eth0
10.0.0.1 ether 00:50:56:c0:00:08 C eth0
arp静态绑定可以防止arp欺骗
arp -s 10.0.0.2 00:50:56:fa:52:36

ip地址
网络ID
主机ID
子网划分
子网合并

 

路由表
查看路由表
route -n
添加
route add [-net|-host|default] target [netmask NM] [gw GW] [[DEV] If]
例子
route add -host 192.168.1.3 gw 172.16.0.1 dev eth0
route add -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1 dev eth0
route add -net 192.168.0.0/24 gw 172.16.0.1 dev eth0
route add -net 192.168.8.0/24 dev eth1 metric 200
添加默认路由
route add -net 0.0.0.0 netmask 0.0.0.0 gw 172.16.0.1
route add -net 0.0.0.0/0 gw 172.16.0.1
route add default gw 172.16.0.1
删除路由
route del [-net|-host] target [gw GW] [netmask NM] [[dev] If]
route del -host 192.168.1.3
route del -net 192.168.0.0 netmask 255.255.255.0

posted @ 2020-06-29 15:53  duanpeng123  阅读(245)  评论(0)    收藏  举报