ssh tunnel/forwarding & iptables

user3489820

I am trying to setup iptables + tunnel via ssh and just can't succeed with this.

I am trying to setup a tunnel:

ssh -N -f -L 8500:localhost:8500 root@<ip-of-the-server>

And the connection is dropped due to last row:

sudo iptables -A INPUT -j DROP

Question: what should I include in iptables to allow such a tunneling from specific IP ie my computer?

Bonsi
iptables -A INPUT --src 127.0.0.1 --protocol tcp --dport 8500 -J ACCEPT

for the tunneld port. This allows connections from 127.0.0.1 to port 8500/tcp

iptables -A INPUT --src $IP_Here --protocol tcp --dport 22 -J ACCEPT

For the ssh-connection (This would allow connections on port 22, which is ssh from $IP_Here, which you have to set/replace with a actual IP Address)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

iptables and ssh

iptables not blocking ssh bruteforce?

Use iptables to block ssh

IPTables ssh port redirect

Config iptables ssh over VPN

Is Iptables blocking outgoing ssh connections?

Linux iptables ssh port forwarding (martian rejection)

IPTables rule to allow incoming SSH connections

How to create SSH reverse tunnel with iptables forwarding?

Best practises: Applying iptables firewall rules for SSH

iptables: All SSH connections for range of DPT

IPTABLES forward all ports except ssh

iptables unable to block local ssh connection

How to allow only ssh and internet access with iptables?

Configuring iptables to port forward ssh connection to a server

iptables: How to allow SSH through debian router?

iptables Couldn't load target `SSH'

Why is iptables -F kicking me out of my ssh session?

In the iptables i have a rule for ssh, why doesn't it work?

iptables is preventing ssh to aws ec2 instance

How can I allow SSH and SMTP only using IPTables?

IPtables : Limit number of new ssh connections per minute

IPtables : Limit number of new ssh connections per minute

iptables rule that allows to connect to ssh from the outside with mac validation

Trying to use iptables to block all traffic except for SSH and RDP

How to Block SSH Brute Force via Iptables and How does it work?

SSH password login: iptables Log/Drops listsDST=18.9.2.13/18.7.33.13

How to redirect all traffic except SSH to one local port with iptables

No SSH access after accidentally denied ssh in ufw/iptables on Snappy Ubuntu Core