0

By default Ubuntu doesn't have open ports (exceptions: Avahi and dhcp).

Assuming that my system is connected to the internet by direct way (no hardware firewall used): If I am sending a UDP packet to for example 124.32.12.3:53. To be able to get an answer a program has to say 'If within 30 seconds (timeout) a UDP packet from 124.32.12.3 (with source port 53) is coming, it's welcome. All other packets I will drop.'

Can somebody tell me which program/module handles this on Ubuntu by default?

Thank you very much!

0

iptables (or ufw, which is just a front end for iptables) would do what you want. The default response timeout for UDP packets is 30 seconds (or very close to it). So you would just need to allow the answer related packet back in and DROP the rest (the below assumes your external IF is eth0):

sudo iptables -A INPUT -i eth0 -d your_external_IP_address -m state --state ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A INPUT -i eth0 -d your_external_IP_address -j DROP

Note that this not the entire answer. If want to use iptables you will have to consider your overall requirements and deal with possible other use requirements accordingly.

There was a similar minimal use case the other day, which you could refer to.

  • But why does it already work without any iptables configuration? – Aliquis Jun 14 '15 at 19:06
  • With no iptables rule set at all, then if your system sends out a UDP DNS request on port 53, it will listen for a reply for 30 seconds. Similarly for any session that you initiate from your computer, the default is that the reply is allowed. In fact, by default all ports are open, it is just that nothing is listening to them. – Doug Smythies Jun 14 '15 at 22:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.