0

I have the following setup:

N computers (static IP) --eth--> Wireless router <--wlan-- M computers (dynamic IP)

  • The computers are running either Ubuntu 14.04 or Windows 10
  • The Router is a Linksys WRT 1900 ACS

Now one of the M computers has a connection to the internet and has been given a static IP by my provider; and for various reasons, it is inconvenient to connect an ethernet cable to the router's Internet port. This computer is going to be running Ubuntu 14.04.

Is it possible to configure the network such that all internet bound traffic to the router is routed through the computer with the internet connection? The primary use for the N computers on the internal network is to run code on Github, so they need to be able to ssh to Github as well as access the apt-repositories. (Edit)

I haven't found any instructions for doing this that quite matches my setup (either the network topology is different or the OS is), and I am not so confident in my abilities that I am willing to dive into the process of changing settings just to test (there is quite a large penalty if I get this irrevocably wrong). Thanks!

  • Only you need to install squid and configure it and iptables, to turn it into a server de internet connection. And place it as a gateway to other pcs. It is common and there are countless tutorials. – kyodake Jun 4 '16 at 0:30
  • Could you please link to one? I'll take a look in the meanwhile – banerjs Jun 4 '16 at 16:02
1

Simple guide:

You can configure Squid for the following topology: the Ubuntu pc must have one NIC (wlan0) connected to the private LAN, and the other one (eth0) connected to the Internet.

To set up a transparent proxy with Squid, you must add necessary iptables rules. These rules should help you get started:

exec sudo -i
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 80 -j REDIRECT --to-port 3128

The first line will enable forwarding

The second line will cause all outbound packets from eth0 (WAN interface) to have the source IP address of eth0.

The third line will redirect all incoming HTTP packets (destined to TCP 80) from wlan0 (LAN interface) to Squid listening ort (TCP 3128), instead of forwarding it out to WAN interface right away.

Now you start Squid installation and you will modify Squid configuration to turn it into a transparent proxy, you define our LAN subnet (e.g., 10.10.10.0/24) as a valid client network. Any traffic not originating from the LAN subnet will be denied access.

sudo exec -i
apt-get update
apt-get install squid
nano /etc/squid/squid.conf 

Simple example of basic content:

## Hostname proxy example ##
http_port 3128 transparent

## Define our network ##
acl our_network src 10.10.10.0/24

## make sure that our network is allowed ##
http_access allow our_network

## finally deny everything else ##
http_access deny all

More info:

http://www.cyberciti.biz/tips/linux-setup-transparent-proxy-squid-howto.html

http://www.brennan.id.au/11-Squid_Web_Proxy.html

https://www.garron.me/en/linux/iptables-manual.html

  • Thanks for sending me this information. However, I tried to use these instructions (as well as instructions from the first and second links that you sent), and it doesn't quite work. Also, I'm adding an edit to the question, but the internal network computers need to be able to ssh to github and access apt (the primary use of these computers is to run code on github). From your second link, it seems that this is not going to be possible with a transparent proxy? – banerjs Jun 6 '16 at 13:50
0

You need to use the router as it is designed. I find that odd connections can drastically change the quality of your network and a stock Linksys' firmware isn't designed for really odd configurations.

Plug your modem into the internet port on your linksys and configure the router to handle the connection. A factory reset may be needed if you have changed more that you remember and can change back.

If you are connecting your computer to the modem and then to the switch on the modem (the group of ports) then you need to change the gateway in your local settings on the router and in DHCP to match your computer's IP. This does rely on your computer to handle the firewall. If this is the case, install fail2ban and look up securing your iptables.

  • Yeah. I'm in the latter case. The computer is connected to the internet modem and the linksys needs to be configured to use the computer as a gateway. I was hoping that someone could provide step-by-step instructions on how to configure the computer to be the internet gateway for the internal network connected to the router – banerjs Jun 4 '16 at 16:06
  • What is the os on the internet computer? – Soul Dessin Jun 5 '16 at 13:59
  • It's running Ubuntu 14.04 – banerjs Jun 5 '16 at 23:13

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.