I had to setup my laptop here as a router for my brother's new gaming rig, and it was a real pain. So, now that I have it figured out, I'm gonna write here what I did so maybe it will help someone.
First lemme define a few things:
* I currently have a ppp connection to the internet (it kinda sucks, but the only other alternative is 56k), this connection is 'ppp0' (it uses a USB port, so I have my ethernet port free).
* I bought a long ethernet cable and ran it to my brother's computer (it runs BlueWhite64, and is setup to use DHCP for eth0, I used 'netconfig'), my computer connects to his also through interface 'eth0', but on my computer I didn't yet setup eth0.
So:
ppp0 is the external connection (connects to internet)
eth0 is the internal connection (connects to my bro's computer)
The steps I took are:
1) As coremp says, run:
Code:
chmod a+x /etc/rc.d/rc.ip_forward
(if you choose to run it now, rather than restart your computer, make sure to call it like '/etc/rc.d/rc.ip_forward start')
2) Go to Alien Bob's EFG and get a new 'rc.firewall' script:
http://www.slackware.com/~alien/efg/
For 'Internet Interface:' I put 'ppp0',
then when it says 'Single System or Private Network Gateway?', choose 'Gateway/Firewall', click 'generate firewall', and then put in your specs...
I put:
Internal Network Interface: eth0
Internal Network IP Address: 192.168.1.1
Internal Network: 192.168.1.0/24
Internal Network Broadcast: 192.168.1.255
then click 'generate firewall', and put the results in '/etc/rc.d/rc.firewall' and make it executable 'chmod a+x /etc/rc.d/rc.firewall'.
If you had another script in there, run '/etc/rc.d/rc.firewall stop', then '/etc/rc.d/rc.firewall start' (not sure if there's a restart option).
3) Now you must edit '/etc/dhcpd.conf', here's what mine looks like:
Code:
# dhcpd.conf
#
# Configuration file for ISC dhcpd (see 'man dhcpd.conf')
ddns-update-style none;
subnet 192.168.1.0 netmask 255.255.255.0 {
option domain-name-servers 84.247.48.3, 172.16.253.242;
option broadcast-address 192.168.1.255;
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
range 192.168.1.2 192.168.1.3;
}
Note that your router's IP is '192.168.1.1', which can also be seen in the firewall script config in #2 above. The subnet is thus the same IP, but with a final '0', hence '192.168.1.0' (this can be seen in the firewall script above along with the type of network, 24 bits form the network, a Class C network). Netmask is the usual '255.255.255.0'. The domain-name-servers here are important, I got them from '/etc/resolv.conf':
Code:
nameserver 84.247.48.3
nameserver 172.16.253.242
The broadcast address is the same as the router IP, but with a final '255', hence '192.168.1.255' (this can also be seen in the firewall script above). Subnet-mask is same as netmask, '255.255.255.0'. And the IP range is up to you, since I will have at most 2 computers on my local network, I didn't make it very big, from '192.168.1.2' to '192.168.1.3'. Also note that 'ddns-update-style none;' is needed, or dhcpd will complain and fail to function.
4) Almost done, now just run:
Code:
ifconfig eth0 192.168.1.1
dhcpd eth0
the ifconfig is to assign yourself (the router) an IP of '192.168.1.1', which you can see in both step #2 and #3 above. Then we start the dhcp server, listening on eth0 for a call from my brother's computer ... probably 'dhcpcd eth0'. Note that you'll probably want to add these two commands to say '/etc/rc.d/rc.local' or somewhere similar, where they will get run on system startup.
That's it. But, don't think it was that easy. It didn't make sense for quite some time. It took me several hours to figure this out ... and I have a headache. Good luck.