配置静态地址转换------发布公司内网网站到互联网上

拓扑图如下:





第1步:配置路由器R1启用的端口信息
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R1
R1(config)#int fa0/0
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#int se2/0
R1(config-if)#ip add 61.135.99.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shut
%LINK-5-CHANGED: Interface Serial2/0, changed state to down
R1(config-if)#end
R1#
%SYS-5-CONFIG_I: Configured from console by console
R1#


第1步:配置路由器R2启用的端口信息
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R2
R2(config)#int se3/0
R2(config-if)#ip add 61.135.99.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#
%LINK-5-CHANGED: Interface Serial3/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial3/0, changed state to up
R2(config-if)#int fa1/0
R2(config-if)#ip add 61.135.100.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#
%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
R2(config-if)#end
R2#
%SYS-5-CONFIG_I: Configured from console by console
R2#
%LINK-5-CHANGED: Interface Serial2/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
R2#



第2步:配置路由器R1的静态路由
R1>en
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#ip route 61.135.100.0 255.255.255.0 61.135.99.2
R1(config)#exit
R1#
%SYS-5-CONFIG_I: Configured from console by console
R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
Gateway of last resort is not set
        61.0.0.0/24 is subnetted, 2 subnets
C       61.135.99.0 is directly connected, Serial2/0
S       61.135.100.0 [1/0] via 61.135.99.2
C       192.168.10.0/24 is directly connected, FastEthernet0/0
R1#



第2步:配置路由器R2的静态路由
R2>en
R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#ip route 192.168.10.0 255.255.255.0 61.135.99.1
R2(config)#exit
R2#
%SYS-5-CONFIG_I: Configured from console by console
R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
Gateway of last resort is not set
        61.0.0.0/24 is subnetted, 2 subnets
C       61.135.99.0 is directly connected, Serial3/0
C       61.135.100.0 is directly connected, FastEthernet1/0
S       192.168.10.0/24 [1/0] via 61.135.99.1
R2#


第3步:测试PC1可以访问Web Server,而现实中在公网地址上输入企业网络的私有地址是不能访问的
http://192.168.10.2
所以在公网上还是使用公网地址访问企业内网私有地址是一种不错的选择


第4步:配置内网地址转换(内网地址转公网地址)
R1>en
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int fa0/0
R1(config-if)#ip nat inside
R1(config-if)#int se2/0
R1(config-if)#ip nat outside
R1(config-if)#exit
R1(config)#ip nat inside source static 192.168.10.2 61.135.99.3
R1(config)#exit
R1#
%SYS-5-CONFIG_I: Configured from console by console
R1#show ip nat translations
Pro  Inside global     Inside local       Outside local      Outside global
---  61.135.99.3       192.168.10.2       ---                ---
R1#



第5步:在公网上测试企业内网的WEB服务器
http://61.135.99.3


在WEB Server被访问后,再一次查看路由器R1内网转换信息
R1#show ip nat translations
Pro  Inside global     Inside local       Outside local      Outside global
---  61.135.99.3       192.168.10.2       ---                ---
tcp 61.135.99.3:80     192.168.10.2:80    61.135.100.2:1027  61.135.100.2:1027
R1#

测试结果表明静态地址转换配置完全成功。

如果使用网址访问网站就需要申请域名,填写静态公网地址IP就填写61.135.99.3即可。

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值