Cisco 路由器设置 1841

网络工程 思科 路由器 纳特 互联网
2021-07-04 00:55:30

我需要一些帮助。我是使用 Cisco 路由器的新手(就我自己设置它们而言),所以如果这是我看过或不理解的简单问题,请原谅我。

我有来自考克斯的有线互联网。他们给出了下面的IP地址:

IP: 98.191.**.147 
DG: 98.191.**.129
SNM 255.255.255.224

IP 地址是将路由器连接到 ISP 调制解调器的 IP 地址。在局域网方面,我有以下几点:

IP address 10.0.4.1
DG 10.0.4.254
SNM 255.255.255.0

我需要做的是取10.0.4网络并告诉它Internet在98.191.**.147网络地址处,然后通过这种方式连接到Internet。我一直在观看有关如何执行此操作的一些 YouTube 视频,但是我缺少一些东西,我无法弄清楚。

这是我迄今为止所拥有的:

我在 10 点网络上没有互联网连接。

Router#show ip interface brief
 Interface IP-Address OK? Method Status Protocol
 FastEthernet0/0 10.0.4.1 YES manual up up
 FastEthernet0/1 98.191.**.147 YES manual up up
 Vlan1 unassigned YES unset administratively down down
 Router#

这是剩下的……

version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface FastEthernet0/0
ip address 10.0.4.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 98.191.**.147 255.255.255.224
duplex auto
speed auto
!
interface Vlan1
no ip address
shutdown
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end

!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface FastEthernet0/0
ip address 10.0.4.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 98.191.**.147 255.255.255.224
duplex auto
speed auto
!
interface Vlan1
no ip address
shutdown
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!

结尾

更新的变化

!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface FastEthernet0/0
 ip address 10.0.4.1 255.255.255.0
 ip nat inside
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 98.191.**.147 255.255.255.224
 ip nat outside
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
ip nat inside source list 1 interface FastEthernet0/1 overload
ip classless
ip route 0.0.0.0 0.0.0.0 FastEthernet0/1 
!
ip flow-export version 9
!
!
access-list 1 permit 10.0.4.0 0.0.0.255
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!

结尾

启动配置

version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface FastEthernet0/0
 ip address 10.0.4.1 255.255.255.0
 ip nat inside
 duplex auto
 speed auto
 shutdown
!
interface FastEthernet0/1
 ip address 98.191.**.147 255.255.255.224
 ip nat outside
 duplex auto
 speed auto
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
ip nat inside source list 1 interface FastEthernet0/1 overload
ip classless
ip route 0.0.0.0 0.0.0.0 FastEthernet0/1 
!
ip flow-export version 9
!
!
access-list 1 permit 10.0.4.0 0.0.0.255
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

2016 年 6 月 17 日的新更新

Router#
Router#show running
Router#show running-config
Building configuration...

Current configuration : 753 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Router
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
!
resource policy
!
mmi polling-interval 60
no mmi auto-configure
no mmi pvc
mmi snmp-timeout 180
ip subnet-zero
ip cef
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 ip address 10.0.4.254 255.255.255.0
 ip nat inside
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 98.191.**.138 255.255.255.224
 ip nat outside
 duplex auto
 speed auto
!
ip classless
!
ip http server
ip nat inside source list 1 interface FastEthernet0/1 overload
!
access-list 1 permit 10.0.4.0 0.0.0.255
!
control-plane
!
!
line con 0
line aux 0
line vty 0 4
 login
!
end

Router#

我可以 ping 98.191.**.147 并获得 100% 的成功,但我尝试 ping 10.0.4.55(另一台电脑)我得到 100% 的失败。

换句话说,我得到单向交通

1个回答

您的 LAN 寻址是私有寻址,您无法将其路由到 Internet。您将需要使用 NAT。您将 WAN 接口设置为外部接口,将 LAN 接口设置为内部接口。然后您需要定义翻译。通常,您希望将来自内部(私有地址)的流量的源 IP 地址转换为您的外部地址(公共地址)。

例子:

interface FastEthernet0/0
 ip address 10.0.4.1 255.255.255.0
 duplex auto
 speed auto
 ip nat inside
!
interface FastEthernet0/1
 ip address 98.191.**.147 255.255.255.224
 duplex auto
 speed auto
 ip nat outside
!
ip nat inside source list 1 interface FastEthernet0/1 overload
!
access-list 1 permit 10.0.4.0 0.0.0.255
!

这会将10.0.4.0/24网络中任何流量的源地址转换为您的 WAN 地址98.191.**.147这样,任何回复流量都会到达您的路由器并被转换回 LAN 上的正确地址。

此外,您将需要一个默认路由:

ip route 0.0.0.0 0.0.0.0 98.191.**.149

为您编辑更新:

以您拥有的方式使用 NAT,您将获得流量的单向发起。外部无法向内部发起流量。这是因为 NAT 表是在流量从内部到外部时构建的,但如果流量来自外部,则表条目不存在。路由器不知道从哪里向内部接口发送流量到其外部接口。通常,这是通过内部的私有寻址和外部的公共寻址来完成的,无论如何,私有地址不能在公共网络上使用。

很可能,您从外部发出的 ping 到达内部主机,但是当内部主机回复时,回复会将其源地址转换为路由器 WAN 地址,因此外部主机看不到它试图发送的地址的回复平。然后 ping 失败,即使它正在工作。