用PC3模拟外网
添加vlan
vlan batch 2 3
- 在LSW1上创建vlan,连接电脑的端口为access端口,连接路由器的端口为TRUNK
int e 0/0/1
port link-type access#设置端口为access
port default vlan 2
int e 0/0/2
port link-type access#设置端口为access
port default vlan 3
int g 0/0/1
port link-type trunk#设置端口为trunk
port trunk allow-pass vlan all#设置端口放行所有vlan
2.路由器作为三层接口设置
配置终结子接口
sys
vlan batch 2 3
int g 0/0/1.1
dot1q termination vid 2
ip add 192.168.1.1 24
arp broadcast enable
q
int g 0/0/1.2
dot1q termination vid 3
ip add 192.168.2.1 24
arp broadcast enable#发布ARP广播
q
3.配置DHCP和DNS
dhcp enable#开启DHCP功能
int g 0/0/1.1
dhcp select interface
dhcp server dns-list 114.114.114.114 8.8.8.8#配置NDS
dhcp enable
int g 0/0/1.2
dhcp select interface
dhcp server dns-list 114.114.114.114 8.8.8.8
4.配置公网接口IP和静态路由
int g 0/0/0
ip add 200.0.0.2 24
q
ip route-static 0.0.0.0 0.0.0.0 200.0.0.1
5.配置NAT,使内网访问外网
acl number 2001
rule 5 permit source 192.168.0.0 0.0.255.255
q
int g 0/0/0
nat outbound 2001
q
结束
6测试
测试DHCP
测试外网连接
用PC3模拟外网
添加vlan
vlan batch 2 3
- 在LSW1上创建vlan,连接电脑的端口为access端口,连接路由器的端口为TRUNK
int e 0/0/1
port link-type access#设置端口为access
port default vlan 2
int e 0/0/2
port link-type access#设置端口为access
port default vlan 3
int g 0/0/1
port link-type trunk#设置端口为trunk
port trunk allow-pass vlan all#设置端口放行所有vlan
2.路由器作为三层接口设置
配置终结子接口
sys
vlan batch 2 3
int g 0/0/1.1
dot1q termination vid 2
ip add 192.168.1.1 24
arp broadcast enable
q
int g 0/0/1.2
dot1q termination vid 3
ip add 192.168.2.1 24
arp broadcast enable#发布ARP广播
q
3.配置DHCP和DNS
dhcp enable#开启DHCP功能
int g 0/0/1.1
dhcp select interface
dhcp server dns-list 114.114.114.114 8.8.8.8#配置NDS
dhcp enable
int g 0/0/1.2
dhcp select interface
dhcp server dns-list 114.114.114.114 8.8.8.8
4.配置公网接口IP和静态路由
int g 0/0/0
ip add 200.0.0.2 24
q
ip route-static 0.0.0.0 0.0.0.0 200.0.0.1
5.配置NAT,使内网访问外网
acl number 2001
rule 5 permit source 192.168.0.0 0.0.255.255
q
int g 0/0/0
nat outbound 2001
q
结束
6测试
测试DHCP
测试外网连接