how to force a Ubuntu to just connect a special IP

by Hosseinmp76   Last Updated November 14, 2017 19:02 PM

I want to install an Ubuntu on a USB drive and configure it to use in programming contest.

so I want to force Ubuntu to connect just to a special site not whole web. how to do it?

Tags : security


Answers 1


You should use iptables

sudo iptables -A INPUT -p tcp --sport 80 -m conntrack --ctstate ESTABLISHED -j REJECT
sudo iptables -A OUTPUT -p tcp --sport 80 -m conntrack --ctstate ESTABLISHED -j REJECT

sudo iptables -A INPUT -s 15.15.15.15 -j ACCEPT
sudo iptables -A OUTPUT -s 15.15.15.15 -j ACCEPT

change 15.15.15.15 to your website's server ip.

Test it, I've not tested it.

A full tutorial here.

Note: This will break system/security updates.

Amir Forsati Q.
Amir Forsati Q.
November 14, 2017 18:15 PM

Related Questions



how do i securly connecting smartphone

Updated June 22, 2015 23:00 PM