使用自定义端口进行 Cisco ASA ssh 端口转发

使用自定义端口进行 Cisco ASA ssh 端口转发

思科 ASA 8.4(1) ADSM 6.4

我正在努力将外部的 SSH 连接转发到我网络内部的非标准端口上的服务器。

如果我想将端口 2828 从外部转发到内部特定 IP 上的端口 22,命令行应该是什么样子的?

更新:提供配置,首先在外部设置标准 SSH 端口,因为我无法让上述功能正常工作。

    : Saved
:
ASA Version 8.4(1) 
!
hostname troll
enable password XXXXXXX encrypted
passwd XXXXXXX encrypted
multicast-routing
names
!
interface Vlan1
 nameif inside
 security-level 100
 ip address 192.168.1.1 255.255.255.0 
!
interface Vlan2
 mac-address 0022.6b6e.4165
 nameif outside
 security-level 0
 ip address dhcp 
!
interface Ethernet0/0
 switchport access vlan 2
!
interface Ethernet0/1
!
interface Ethernet0/2
!
interface Ethernet0/3
!
interface Ethernet0/4
!
interface Ethernet0/5
!
interface Ethernet0/6
!
interface Ethernet0/7
!
ftp mode passive
dns domain-lookup inside
dns server-group DefaultDNS
 name-server 8.8.8.8
 name-server 8.8.4.4
same-security-traffic permit inter-interface
object network obj_any 
 subnet 0.0.0.0 0.0.0.0
object network outside 
 host 10.10.10.0
 description outside 
object network vm 
object network inside-host-object 
 host 192.168.1.100
access-list outside_access_in extended permit tcp any object inside-host-object eq ssh 
pager lines 24
logging enable
logging asdm informational
mtu inside 1500
mtu outside 1500
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
nat (inside,outside) source dynamic any interface
!
object network inside-host-object
 nat (inside,outside) static interface service tcp ssh 2828 
access-group outside_access_in in interface outside
route outside 0.0.0.0 0.0.0.0 10.10.10.0 1
timeout xlate 3:00:00
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00
timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute
timeout tcp-proxy-reassembly 0:01:00
dynamic-access-policy-record DfltAccessPolicy
http server enable
http 192.168.1.0 255.255.255.0 inside
no snmp-server location
no snmp-server contact
snmp-server enable traps snmp authentication linkup linkdown coldstart warmstart
telnet timeout 5
ssh timeout 5
console timeout 0

dhcp-client client-id interface outside
dhcpd auto_config outside
!
dhcpd address 192.168.1.9-192.168.1.40 inside
dhcpd dns 8.8.8.8 8.8.4.4 interface inside
dhcpd enable inside
!
threat-detection basic-threat
threat-detection statistics access-list
no threat-detection statistics tcp-intercept
webvpn
!
class-map inspection_default
 match default-inspection-traffic
!
!
policy-map type inspect dns preset_dns_map
 parameters
  message-length maximum client auto
  message-length maximum 512
policy-map global_policy
 class inspection_default
  inspect dns preset_dns_map 
  inspect ftp 
  inspect h323 h225 
  inspect h323 ras 
  inspect rsh 
  inspect rtsp 
  inspect esmtp 
  inspect sqlnet 
  inspect skinny  
  inspect sunrpc 
  inspect xdmcp 
  inspect sip  
  inspect netbios 
  inspect tftp 
  inspect ip-options 
!
service-policy global_policy global
prompt hostname context 
: end
no asdm history enable

答案1

您将在为内部主机定义的网络对象中配置此项。如果您已经有一个网络对象,则需要对其进行适当的更改。

object network inside-host-object
 ! 192.0.2.1 is your internal address for this server..
 host 192.0.2.1
 ! ..and 203.0.113.1 is the external address that you want to use.
 nat (inside,outside) static 203.0.113.1 service tcp 22 2828

而且您还需要确保外部接口的 ACL 允许流量 - 根据 NAT 后 IP 和端口允许流量(因此,在此示例中,目的地为 192.0.2.1,端口为 22),这与旧 ASA 行为不同。

相关内容