I'm trying to configure iptables to allow access to certain ports. So I've set up a few rules. One of the rules is to ACCEPT all traffic from localhost.

iptables -A INPUT -i lo -j ACCEPT

Other rules open certain ports.

How can I test if these rules are working as intended, if I have no access to a different machine on the LAN?

Since there is a rule to accept all traffic from localhost, when I try something like the following from my own server:

ssh -p <someport> [email protected]

it obviously accepts traffic and tries to establish the connection, because as I understand, it 'knows' INPUT is coming from localhost in any case.

However, how can I check if my firewall would accept traffic coming from different machine on the LAN? (if again, I don't have access to another computer to check at the moment)?

I have been trying to find a solution, for instance, with a tun/tap virtual device? The idea would be to try and send some packets as though they were coming from a different machine on the network, not the localhost.

If this is possible, how could this be accomplished?

Another idea is to set up a virtual machine from where I can send packets and test.

If there are better solutions, which are they?

  • ssh -p <someport> [email protected] would actually use your LAN address, not localhost even though it would never be sent over the network. Commented Jun 14, 2016 at 5:24

1 Answer 1


Try "nmap -p " and "nmap -p " if is your IP. Use switch "-sU" to check for udp. Check with "ss -tulpn" what services are listening on which ports.

You must log in to answer this question.