一、网络拓朴如下:
二、要求:PC1 能访问到Server1
三、思路:
R2配置DHCP,R2和R1配OSPF,R1出NAT
四、主要配置:
R2的DHCP和OSPF:
ip pool 1
gateway-list 10.1.1.1
network 10.1.1.0 mask 255.255.255.0
dns-list 8.8.8.8
#
interface GigabitEthernet0/0/0
ip address 1.1.1.2 255.255.255.0
ospf enable 1 area 0.0.0.0
#
interface GigabitEthernet0/0/1
ip address 10.1.1.1 255.255.255.0
ospf enable 1 area 0.0.0.0
dhcp select global
#
ospf 1
area 0.0.0.0
network 1.1.1.0 0.0.0.255
network 10.1.1.0 0.0.0.255
#
R1配置NAT和OSPF:
acl number 2000
rule 5 permit
#
nat address-group 1 100.1.1.1 100.1.1.1
#
interface GigabitEthernet0/0/0
ip address 1.1.1.1 255.255.255.0
ospf enable 1 area 0.0.0.0
#
interface GigabitEthernet0/0/1
ip address 100.1.1.1 255.255.255.252
ospf enable 1 area 0.0.0.0
nat outbound 2000
#
#
ospf 1
area 0.0.0.0
network 1.1.1.0 0.0.0.255
network 100.1.1.0 0.0.0.3
#
*tips:
这里在opsf区域后面,如果宣告的接口太多,需要全部宣告ospf的话,可以用一个命令启用所有接口的ospf:
ospf 1
area 0.0.0.0
network 0.0.0.0 0.0.0.0
#