1

I have 2 network cards, I need one of them to be used for work and the other is an open public network.

I'd like to use the work network card for ssh only:

hutber@hutber-blade ~ $ sudo iptables -S | grep enx9cebe863eaa8
-A INPUT -i enx9cebe863eaa8 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT ! -i enx9cebe863eaa8 -p tcp -m tcp --dport 22 -j 

I have setup the following rules, but once I enable enx9cebe863eaa8 all network traffic goes through this card.

  • That second rule would match tcp/22 on all other interfaces, but you're missing the argument to -j. You'd need DROP (or REJECT) on the same interface to block everything else. And routes set up sanely for the communication to work. Do you have that already in place, or setting up the routing part of the question? – ilkkachu Jul 4 '18 at 16:55
  • 1
    there is a listen adress in sshd_config which restrict sshd ot listen only in that IP. – Archemar Jul 4 '18 at 17:26
  • Thanks @Archemar I always thought the sshd config ListenAddress would mean that ssh can't use any other IP, but I didn't realise it blocked the IP from using any other ports as well. If I understand you correctly? – Jamie Hutber Jul 5 '18 at 10:26
  • yes ListenAddress 192.168.100.100 will listen only on this IP, incomming ssh connection to 192.168.1.100 on same host will be droped by inetd (not sshd). You won't be able to ssh localhost either. (this might or might not be an indrance, but can be usefull to test) – Archemar Jul 5 '18 at 11:07
  • Thanks again Arch. I still think you mis understand me. Please confirm back lol because I am confused. When I use ListenAddress 192.168.100.100 in my ssh/config file. 192.168.100.100 will ONLY be able to use port 22 and NO other ports? – Jamie Hutber Jul 6 '18 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.