I've got a network: PC --> LinuxRouter --> Internet

I have:

  • 2 interfaces on LinuxRouter
    • eth0 ( is connected to internet
    • eth1 (
  • 1 interface on PC eth0 (

I've already edited DEFAULT_FORWARD_POLICY="ACCEPT" on /etc/default/ufw and already edited net.ipv4.ip_forward=1 on /etc/ufw/sysctl.conf.

On LinuxRouter when DEFAULT_OUTPUT_POLICY="DROP" I can't go to any website. But if I enter:

$ sudo ufw allow out 80 && sudo ufw allow out 443

I'll be able to go on any website.

I'd like to know how to ALLOW only the port I want to be forwarded through my LinuxRouter, while DEFAULT_FORWARD_POLICY="DROP"?

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.