【H3C】pc+交换机+路由器+连外网

实验要求

① pc1 是固定ip,pc2 、pc6自动获取
② pc机,能联通联通外网
【H3C】pc+交换机+路由器+连外网_第1张图片

实验步骤

1、pc1 设置静态IP 两个路由器设ip

[R]INT g0/0
[R-GigabitEthernet0/0]ip ad 100.10.10.2 24
[R-GigabitEthernet0/0]INT g0/1
[R-GigabitEthernet0/1]ip ad 10.10.10.2 24

[R联通]int g0/0
[R联通-GigabitEthernet0/0]ip a 10.10.10.2 24
[R联通]int LoopBack 6
[R联通-LoopBack6]ip ad 6.6.6.6 24

2、主交换

2.1 交换机上联口 改rount 并ip

[SW]in g1/0/1
[SW-GigabitEthernet1/0/1]port link-mode r
[SW-GigabitEthernet1/0/1]ip a 100.10.10.1 24

2.2 交换机起vlan 并虚拟口 +ip

[SW-Vlan-interface20]int vlan 1
[SW-Vlan-interface1]ip ad 192.168.10.254 24

[SW]vlan 20
[SW-vlan20]port g1/0/4
[SW-vlan20]int vlan 20
[SW-Vlan-interface20]ip ad 192.168.20.254 24

2.3 起dhcp 并地址池

[SW]dhc en
[SW]dhc server ip-pool 10
[SW-dhcp-pool-10]netw 192.168.10.0 24
[SW-dhcp-pool-10]gateway-list 192.168.10.254

[SW-dhcp-pool-10]dhc ser ip-pool 20
[SW-dhcp-pool-20]netw 192.168.20.0 24
[SW-dhcp-pool-20]gateway-list 192.168.20.254

2.3 起ospf

[SW]ospf
[SW-ospf-1]area 1
[SW-ospf-1-area-0.0.0.1]netw 192.168.10.0  0.0.0.255
[SW-ospf-1-area-0.0.0.1]netw 192.168.20.0  0.0.0.255
[SW-ospf-1-area-0.0.0.1]netw 100.10.10.0 0.0.0.255

3、主路由起ospf

[R]ospf
[R-ospf-1]a 1
[R-ospf-1-area-0.0.0.1]netw 100.10.10.0 0.0.0.255
[R-ospf-1-area-0.0.0.1]netw 10.10.10.0 0.0.0.255

至此 下图 通 10.1 不通10.2
【H3C】pc+交换机+路由器+连外网_第2张图片

<H3C>ping 10.10.10.1
Ping 10.10.10.1 (10.10.10.1): 56 data bytes, press CTRL_C to break
56 bytes from 10.10.10.1: icmp_seq=0 ttl=254 time=1.000 ms
56 bytes from 10.10.10.1: icmp_seq=1 ttl=254 time=1.000 ms

<H3C>ping 10.10.10.2
Ping 10.10.10.2 (10.10.10.2): 56 data bytes, press CTRL_C to break
Request time out
Request time out

4 、主路由上 acl 地址转换

[R]acl b 2000
[R-acl-ipv4-basic-2000]rul p source 192.168.0.0 0.0.255.255
[R-acl-ipv4-basic-2000]int g0/1
[R-GigabitEthernet0/1]nat o
[R-GigabitEthernet0/1]nat outbound 2000

至此 ↓ ↓


ping 10.10.10.2
Ping 10.10.10.2 (10.10.10.2): 56 data bytes, press CTRL_C to break
56 bytes from 10.10.10.2: icmp_seq=0 ttl=253 time=1.000 ms
56 bytes from 10.10.10.2: icmp_seq=1 ttl=253 time=2.000 ms

ping 6.6.6.6
Ping 6.6.6.6 (6.6.6.6): 56 data bytes, press CTRL_C to break
Request time out
Request time out

5 、路由器上 和交换机上 设默认路由

[SW]ip route-static 0.0.0.0 0 100.10.10.2
[R]ip route-static 0.0.0.0 0 10.10.10.2

至此↓↓

ping 6.6.6.6
Ping 6.6.6.6 (6.6.6.6): 56 data bytes, press CTRL_C to break
56 bytes from 6.6.6.6: icmp_seq=0 ttl=253 time=1.000 ms
56 bytes from 6.6.6.6: icmp_seq=1 ttl=253 time=1.000 ms

实验总结

【H3C】pc+交换机+路由器+连外网_第3张图片

你可能感兴趣的:(H3C,网络,服务器,linux)