Ubuntu – LAN and WAN at the same cable

iptablesnat;routingUbuntuvlan

Can I connect LAN and Internet using the same cable?

  LAN computers ------\
  Ubuntu server ------Switch
  ADSL Router --------/

I want to make LAN computers 192.168.0.2-50, server will have real IP 192.168.0.1 and some "virtual" IP 192.168.1.2. ADSL router will have 192.168.1.1.

So all traffic will go via server where I can make statistics, filters etc.

Best Answer

yes, you can. it's called router-on-the-stick configuration, just make sure your switch supports tagged vlans and put wan [adsl] and lan in separate vlans, connect trunk with tagging to the linux box.

under linux you treat separate vlans like they were separate interfaces. debian way of configuring those: here.