Motivation:
I want to use my linux server instead of the average wireless router for several reasons
- I want to learn how to set up a more complete server on linux
- I don't want to have a modem, connected to a router, connected to a network switch
- I am sick and tired of having to unplug my router every 10 days because it just hangs
- I am sick and tired of buying routers only to realize they are missing something crucial, like port forwarding or static ip addressing (dhcp)
Set up:
Ultimately, the connection will come into a modem, and straight into my server through eth0
, then eth1
will output to a network switch which all other client computers will connect to via ethernet cables (forget wireless for the moment). Currently, however, I am in an office building, and I have the connection coming into a modem, which goes into a router, which goes into a network switch, which then goes into eth0
as specified above.
Current Tutorials:
I looked at some tutorials (Ubuntu tutorial is the best one), and I have looked at some of the router questions here (ie. this one), but they all gloss over several key concepts, like:
- What is
eth1
's relation toeth0
? In/etc/network/interfaces
do I have to telleth1
to useeth0
as thenetwork
(generally it is the actual physical router address)? - Do I have to do anything to instruct
eth1
to take the internet that comes intoeth0
and pass it onto whoever wants it in the network switch?
Current Approach:
Here is my /etc/network/interfaces
file on the server:
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.70
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8
auto eth1
# iface eth1 inet dhcp
iface eth1 inet static
address 192.168.7.0
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
And ifconfig
tells me that both NICs are working fine:
eth0 Link encap:Ethernet HWaddr 20:cf:30:55:a0:5f
inet addr:192.168.1.70 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::22cf:30ff:fe55:a05f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11297 errors:0 dropped:0 overruns:0 frame:0
TX packets:16639 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:948633 (948.6 KB) TX bytes:1274685 (1.2 MB)
eth1 Link encap:Ethernet HWaddr 00:11:95:f7:f4:6d
inet addr:192.168.7.0 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::211:95ff:fef7:f46d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:243 errors:0 dropped:0 overruns:0 frame:0
TX packets:3231 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:29934 (29.9 KB) TX bytes:213055 (213.0 KB)
Interrupt:21
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:5348 errors:0 dropped:0 overruns:0 frame:0
TX packets:5348 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:470737 (470.7 KB) TX bytes:470737 (470.7 KB)
wlan0 Link encap:Ethernet HWaddr bc:f6:85:f8:70:5c
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
And here is what route -n returns
on the server:
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
Then on the client I have
auto lo
iface lo inet loopback
iface eth0 inet dhcp
But it is not being assigned an ip address.
EDIT: Here is the isc-dhcp-server configuration file located at /etc/dhcp3/dhcpd.con
which I copied mostly from this site.
# Sample /etc/dhcpd.conf
# (add your comments here)
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "mydomain.example";
subnet 192.168.7.0 netmask 255.255.255.0 {
range 192.168.7.10 192.168.7.25;
}
EDIT: Output of sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
LOG all -- anywhere anywhere LOG level warning
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Question:
What crucial steps/components am I missing in this setup?
dhcp
(and thusdhcpd
) is not mandatory, and is only meant for centralizing all static ips at the server (as opposed to changing the/etc/network/interfaces
file in every host). Therefore, I have decided to not experiment with that until this works. I do however havedhcp3-server
installed, as well asisc-dhcp-server
dhcpd.conf
file and indicated that I am usingisc-dhcp-server