cisco2600的nat问题
我们公司装了网通的光纤,路由器是cisco的2600,原来的环境是这样的:f0/0: 172.30.6.6/255.255.255.252 据网通的说,这是互联IP,是172.30.6.4/30,默认路由是172.30.6.5 必须这么配。
f0/1: 211.101.7.161/255.255.255.224,默认网关是211.101.7.161,可用ip是211.101.7.160到211.101.7.191,这是公网ip。
从光猫上出来一根线,连到路由器上(怎么才能知道它连的是f0/0还是f0/1呢),然后从路由器上出来一根线连到sonicwall的vpn上,vpn的地址是192.168.0.2,在vpn上做的nat,局域网的ip段是192.168.0.0,所有的客户端把网关设成192.168.0.2(vpn)就可以上网。
当时的配置是这样的:
Building configuration...
Current configuration : 836 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
service password-encryption
!
hostname router
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$XOtQ$ojfTfsKfyKxZtTWNaz5mR/
!
no network-clock-participate slot 1
no network-clock-participate wic 0
no aaa new-model
no ip subnet-zero
no ip cef
!
!
!
no ftp-server write-enable
!
!
!
!
interface FastEthernet0/0
ip address 172.30.6.6 255.255.255.252
ip accounting output-packets
speed 10
half-duplex
!
interface FastEthernet0/1
ip address 211.101.7.161 255.255.255.224
ip access-group 120 in
duplex auto
speed auto
!
ip classless
ip route 0.0.0.0 0.0.0.0 172.30.6.5
no ip http server
!
!
line con 0
line aux 0
line vty 0 4
password 7 0112020952050F1C355E4F1D1617
login
!
!
!
end
现在我想把vpn÷代理上网的功能去掉,直接用路由器来做nat,那么f0/0的172那个网段应该是内部端口吧,没有192网段,所以我在f0/0里加了个192.168.0.3 secondary,加了ip nat inside,配置变成
Building configuration...
Current configuration : 1019 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
service password-encryption
!
hostname router
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$XOtQ$ojfTfsKfyKxZtTWNaz5mR/
!
no network-clock-participate slot 1
no network-clock-participate wic 0
no aaa new-model
no ip subnet-zero
no ip cef
!
!
!
no ftp-server write-enable
!
!
!
!
interface FastEthernet0/0
ip address 192.168.0.3 255.255.255.0 secondary
ip address 172.30.6.6 255.255.255.252
ip accounting output-packets
ip nat inside
speed 10
half-duplex
!
interface FastEthernet0/1
ip address 211.101.7.161 255.255.255.224
ip access-group 120 in
ip nat outside
duplex auto
speed auto
!
ip nat pool rout 211.101.7.162 211.101.7.191 netmask 255.255.255.224
ip nat inside source list 2 pool rout
ip classless
ip route 0.0.0.0 0.0.0.0 172.30.6.5
no ip http server
!
access-list 2 permit 192.168.0.0 0.0.0.255
!
line con 0
line aux 0
line vty 0 4
password 7 0112020952050F1C355E4F1D1617
login
!
!
!
end
然后我把客户端的网关改成192.168.0.3,结果上不了网了,改回192.168.0.2能上网,但是网络一天之内断了3次(感觉跟配置有关系)
我把192网段加在f0/0应该是对的吧,nat配的应该也对啊,为什么不行呢?
大侠们帮帮忙啊 我发现不管是把192.168.0.3配到那个端口,从局域网都ping不通0.3这个地址,但是ping172和211都能通 我不知道看明白没有,vpn(192.168.0.2)现在是你的内网的网关,内网要上网只有通过这个网关才可以。
而192.168.0.3是你的F0/0的地址
你在你的vpn里使用固定IP地址上网,IP地址是192.168.0.2/255.255.255.0网关是192.168.0.3
这样做的话,你vpn(启动dhcp)内的用户IP就在192.168.0~255之间,网关是192.168.0.2
这样就可以上网拉 我现在就是想把vpn 去掉,直接用路由器来上网,想在路由器上配个192.168.0.3的地址,然后把网关设成192.168.0.3来上网。 interface FastEthernet0/1
ip address 211.101.7.161 255.255.255.224
ip access-group 120 in
ip nat outside
duplex auto
speed auto
!
我的Cisco路由器ip nat outside是在S0端口配置的 你们慢慢思考
我只是路过``
一看到那么多的数字啊字母啊
就头晕~:L 你们慢慢思考
我只是路过``
一看到那么多的数字啊字母啊
就头晕~:L 你们慢慢思考
我只是路过``
一看到那么多的数字啊字母啊
就头晕~:L
你看一下这个,我觉得你的内网端口选择有一点问题!
你看一下这个,我觉得你的内网端口选择有一点问题!使用网络地址翻译(NAT)
NAT(Network Address Translation)起到将内部私有地址翻译成外部合法的全局地址的功能,它使得不具有合法IP地址的用户可以通过NAT访问到外部Internet.
当建立内部网的时候,建议使用以下地址组用于主机,这些地址是由Network Working Group(RFC 1918)保留用于私有网络地址分配的.
?; Class A:10.1.1.1 to 10.254.254.254
?; Class B:172.16.1.1 to 172.31.254.254
?; Class C:192.168.1.1 to 192.168.254.254
命令描述如下:
任务 命令
定义一个标准访问列表 access-list access-list-number permit source
定义一个全局地址池 ip nat pool name start-ip end-ip {netmask netmask | prefix-length prefix-length}
建立动态地址翻译 ip nat inside source {list {access-list-number | name} pool name | static local-ip global-ip}
指定内部和外部端口 ip nat {inside | outside}
如下图所示,
路由器的Ethernet 0端口为inside端口,即此端口连接内部网络,并且此端口所连接的网络应该被翻译,Serial 0端口为outside端口,其拥有合法IP地址(由NIC或服务提供商所分配的合法的IP地址),来自网络10.1.1.0/24的主机将从IP地址池c2501中选择一个地址作为自己的合法地址,经由Serial 0口访问Internet。命令ip nat inside source list 2 pool c2501 overload中的参数overload,将允许多个内部地址使用相同的全局地址(一个合法IP地址,它是由NIC或服务提供商所分配的地址)。命令ip nat pool c2501 202.96.38.1 202.96.38.62 netmask 255.255.255.192定义了全局地址的范围。
设置如下:
ip nat pool c2501 202.96.38.1 202.96.38.62 netmask 255.255.255.192
interface Ethernet 0
ip address 10.1.1.1 255.255.255.0
ip nat inside
!
interface Serial 0
ip address 202.200.10.5 255.255.255.252
ip nat outside
!
ip route 0.0.0.0 0.0.0.0 Serial 0
access-list 2 permit 10.0.0.0 0.0.0.255
! Dynamic NAT
!
ip nat inside source list 2 pool c2501 overload
line console 0
exec-timeout 0 0
!
line vty 0 4
end
页:
[1]
2