config ufw for router purpose

sometimes we need to share our internect connection without losing any protection, here ufw can help us.

1:

open /etc/default/ufw

change DEFAULT_FORWARD_POLICY = "ACCEPT"

             DEFAULT_INCOMING_POLICY = "ACCEPT"

2: open /etc/ufw/sysctl.conf and uncomment

   net/ipv4/ip_forward=1

  for ipv6 net/ipv6/conf/default/forwarding=1

扫描二维码关注公众号,回复: 1206683 查看本文章

3: add rules to the /etc/ufw/before.rules

right beneath *filter rules

add

*nat

:POSTROUTING ACCEPT [0:0]

-A POSTROUTING -s 192.168.2.0/24 -o ppp0 -j MASQUERADE

sudo ufw disable & enable

done.

猜你喜欢

转载自mathgl.iteye.com/blog/1998627
ufw