H
H
hllwrld2018-10-07 00:45:27
linux
hllwrld, 2018-10-07 00:45:27

How to allow access to the Internet from only one IP address?

Hello. I'm trying to make it so that you can only access the Internet using vpn -

sudo iptables -A INPUT ! -s АЙПИ -j DROP
sudo iptables -A OUTPUT ! -s АЙПИ -j DROP

Linux is green, I just read about iptables today. Judging by the content, these 2 commands prohibit sending and receiving packets if it is not IP. However, it turns out that when I try to go to some web page, the connection is reset, although in the VPN connection settings (openVPN configuration) the gateway is specified as IP. Please help me what am I doing wrong

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vreitech, 2018-10-07
@fzfx

It's not clear how you have it set up.
what IP-address and the gateway at a setevushka? what - in VPN? which one do you block in iptables?
Well, in the first rule there should be not -s, but -d.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question