外网远程登录之 NAT server

案例:

外网远程登录内网SW:

  • 需求

    1.内网的PC都可以访问Server1

    2.外网的R2可以远程登录SW1,

    用户名和密码是:HCIE/hehe

 

  • 需求

    1.内网的PC都可以访问Server1

    2.外网的R2可以远程登录SW1,

    用户名和密码是:HCIE/hehe

 

PC1:
192.168.1.1
255.255.255.0
192.168.1.254

PC2:
192.168.1.2
255.255.255.0
192.168.1.254
-----------------------------------------------------
SW1:
undo terminal monitor
system-view
sysname SW1
vlan 10 
quit 
port-group group-member gi0/0/1 to gi0/0/3
port link-type access
port default vlan 10 
quit 

interface vlanif 10
ip address 192.168.1.10 24
quit 

user-interface vty 0 4
authentication-mode aaa
quit 

aaa
local-user HCIE password cipher hehe
local-user HCIE service-type telnet
local-user HCIE privilege level 15
quit 
-----------------------------------------------------
R1:
undo terminal monitor
system-view
sysname R1
interface gi0/0/1
ip address 192.168.1.254 24
quit 
interface gi0/0/0
ip address 100.1.1.1 24
quit 
-----------------------------------------------------
R2:
undo terminal monitor
system-view
sysname R2
interface gi0/0/1
ip address 200.1.1.254 24
quit 
interface gi0/0/0
ip address 100.1.1.3 24
quit 

Server1:
200.1.1.1
255.255.255.0
200.1.1.254
-------------------------------------------------

@为了实现内网到外网的访问,在边界设备R1的外网接口上配置 EasyIP

ip route-static  0.0.0.0  0  100.1.1.3

acl 2000
rule 10 permit source 192.168.1.0  0.0.0.255
quit 

interface gi0/0/0
nat outbound 2000
quit 

@为了实现外网到内网的访问,在边界设备R1的外网接口上配置 nat server
interface gi0/0/0
nat server protocol tcp global 100.1.1.2 2933 inside 192.168.1.10 23
//指的是:当该端口上收到从外网来的 TCP 协议的数据包,并且目标IP地址是 100.1.1.2
  目标端口是 2933 的时候,将目标IP地址,转换为 192.168.1.10 ,端口号转换为23
  
  然后接下来,R1继续查找路由表,然后将转换后的数据包,发送给了 SW1 . 
  
  此时,还需要在 SW1 上,添加一个可以返回到 R2 的 路由条目: 
  
  SW1:
  ip route-static 0.0.0.0  0  192.168.1.254
  
  --------------------------------------------------
  测试:
  PC1 ping 200.1.1.1 ,互通;
  PC2 ping 200.1.1.1 ,互通;
  R2上进行 telnet 测试:
 <R2>telnet 100.1.1.2 2933 -> 修改telnet 使用的默认端口23为2933
  Press CTRL_] to quit telnet mode
  Trying 100.1.1.2 ...
  Connected to 100.1.1.2 ...

Login authentication

Username:HCIE
Password:
Info: The max number of VTY users is 5, and the number
      of current VTY users on line is 1.
      The current login time is 2022-04-14 09:36:08.
<SW1>
 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值