LAN and WAN at the same cable?
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.
Solution 1:
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.
Solution 2:
The ideal way would be to use VLANs.
But, if you don't have equipment that will support VLANs, you may be able to do this via a single network without VLANs.
You can put multiple IPs on a single interface, but normally the router system would notice that both the source and destination for the packets are on the same interface. You will have to disable this, it is called an ICMP redirect. You can disable it on the interface in question by writing "0" to the file /proc/sys/net/ipv4/conf/<ifname>/send_redirects
.
The WAN and the LAN will need to have different IP address blocks, and you will also almost certainly have to disable DHCP on the WAN router, or configure it to only give addresses to the Ubuntu router machine.
You may also run into problems with other broadcast or multicast traffic, but this will probably work for some situations. However, realize that it is a very unusual configuration and is likely to require some futzing to get to work.