sniffer实验1

网关实质上是一个网络通向其他网络的IP地址。比如有主机A和主机B,主机A的IP地址为“192.168.1.1”,子网掩码为255.255.255.0;主机B的IP地址为“192.168.2.1”,子网掩码为255.255.255.0。在没有路由器的情况下,两个主机之间是不能进行TCP/IP通信的,因为两者之间的网络是不同的,即使是两个主机连接在同一台交换机(或集线器)上,TCP/IP协议也会根据子网掩码(255.255.255.0)判定两个主机处在不同的网络里。而要实现这两个主机之间的通信,则必须通过网关。

如果主机A发现数据包的目的主机不在本地网络中,就把数据包转发给它自己的网关,再由网关转发给主机B的网关,主机B的网关再转发给主机B。

总的来说,网关就是一个中转站,主机的网关与主机是处于同一网络内的。

<Quidway>system

password:

[Quidway]sysname S3026          ;交换机命名

[S3026]super password 111       ;设置特权密码

[S3026]user-interface vty 0 4  ;进入虚拟终端0-4

[S3026-ui-vty0-4]authentication-mode password ;设置口令模式

[S3026-ui-vty0-4]set authentication-mode password simple 222 ;设置口令

[S3026-ui-vty0-4]user privilege level 3 ;用户级别

[S3026-ui-vty0-4]quit

[S3026]quit

<S3026>sys password:111

[S3026]display currect-config;显示当前配置

[S3026]dis curr;显示当前配置

[S3026]vlan 2;创建VLAN

[S3026-vlan2]port ethernet0/2 ;在VLAN中增加端口

[S3026-vlan2]port e0/4 to et0/6;在VLAN中增加端口

[S3026-vlan2]quit

[S3026]dis vlan ;查看VLAN设置

[S3026]int e0/3

[S3026-Ethernet1]port access vlan 2;当前端口加入到VLAN

[S3026-Ethernet1]quit

[S3026]dis vlan

[S3026]dis curr

[S3026]interface vlan 1 ;进入接口视图

[S3026-Vlan-interface1]ip address 10.65.1.8 255.255.0.0

[S3026-Vlan-interface1]quit

[S3026]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2;静态路由=网关

[S3026]ip default-gateway 10.65.1.2

[S3026]dis curr

[S3026]save

双击小电脑:

login:root

password:linux

[root@PCA root]#ifconfig eth0 10.65.1.1 netmask 255.255.0.0

[root@PCA root]#ifconfig

[root@PCA root]#route add default gw 10.65.1.2

[root@PCA root]#route

[root@PCA root]#ping 10.65.1.8

[root@PCA root]#telnet 10.65.1.8

原文地址:https://www.cnblogs.com/qixin/p/3111685.html