相关命令:
过入交换机
Enable
建立VLAN
Vlan data
Vlan 10
Vlan 20
Conf t
加入相应Vlan中
Interface fast 0/1
Switch access vlan 10
Interface fast 0/2
Switch access vlan 20
标示级连口为Trunk
Interface fast 0/12
Switch mode trunk
进入路由器
Enable
Conf t
进入E0的虚拟口,进行配置,设定两个IP则为两个网关。
interface Ethernet 0.0
ip address 192.168.10.254 255.255.255.0
interface Ethernet 0.1
ip address 192.168.20.254 255.255.255.0
进入物理口配置,
interface fast 0/0
no shutdown
访问控制列表的建立
禁止10 网段到20网段的TCP协议通过,100为任意值,注决以下三条命令要同时存在,表示10网段虽然不能到达20网段,但还是可以到达其网段:
access-list 100 deny TCP 192.168.10.0 0.0.0.255 192.168.20.0 0.0.0.255
access-list 100 permit tcp any any
interface fast 0/0
ip access-group 100 in/out
S0口一般用于连接外网,同样可以设置IP地址,并且设定是否可以通过外网出去。