LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Slackware Router (https://www.linuxquestions.org/questions/slackware-14/slackware-router-584724/)

blueAlien 09-14-2007 05:14 PM

Slackware Router
 
I want to make my own router using an old computer and slackware. The hardware includes, two 10/100 nic cards and one dlink 802.11g wireless card. I want one nic (eth0) to use dhcp to obtain an ip address, the other nic (eth1) to have a static ip address of 10.0.0.1 and the wireless card (ath0) to have a static ip address of 192.168.1.1. A firewall should be implemented along with a dhcp server for other computers on the network to obtain their ip addresses.

Just wondering if anyone has taken on a similar projects, and what results you have had with different programs...

Thanks,
blue

erklaerbaer 09-14-2007 06:59 PM

should'nt be a problem, have a look at /etc/rc.d/rc.inet1.conf

for the dhcpserver i'd suggest dnsmasq and for the firewall http://www.slackware.com/~alien/efg/ might prove useful

blueAlien 09-15-2007 01:31 PM

So how do I make that server act as a gateway also? What do I use to forward the internet? Does slackware 12 already have a dhcp server installed, or am I going to have to install one on my own?

Only thing I really know about setting up a server is apache, php, and mysql. I really don't even know where to start on anything else...

Thanks,
blue

H_TeXMeX_H 09-15-2007 02:21 PM

I believe dnsmasq is a 'DNS forwarder and DHCP server', it is installed if you did a full install, if not, then install the package off the disk. Now, you do have to configure it properly.

onebuck 09-15-2007 06:12 PM

Quote:

Originally Posted by blueAlien (Post 2892892)
So how do I make that server act as a gateway also? What do I use to forward the internet? Does slackware 12 already have a dhcp server installed, or am I going to have to install one on my own?

Only thing I really know about setting up a server is apache, php, and mysql. I really don't even know where to start on anything else...

Thanks,
blue

Hi,

You need to look at the Net-HOWTO to get some useful information.

You want basically a file server with NAT, firewall and services. This can be done easily with Slackware using the Net-HOWTO.

You could also reference a lot of links in 'Slackware-Links' which was compiled from 'Slackware LQ Suggestions Links!'.

You will find the quagga and zebra router projects listed in the network section of the above links if you just want to implement a router.

coremp 09-16-2007 07:31 AM

make the following occur

1. install slackware to be in ip-forward mode. selectable at setup, or via making this file executable: /etc/rc.d/rc.ip_forward

2. add to /etc/rc.d/rc.local
eth0 gets IP via dhcpcd from your modem. put modem in half bridge mode for the linux box to do authenication, if you have permanent IP, do after initial setup. 1 step at a time!
/sbin/dhcpcd eth0

eth1 gives out IP's via dhcpd
/sbin/dhcpd eth1

run your filewall
/etc/rc.d/rc.firewall # get hold of a script on the net....somewhere!


3. add to /etc/revsolve.conf
put your gateway server address here if not doing authentication. else your isp DNS address
nameserver 10.0.0.34

4. add your dns server address to your /etc/dhcpd.conf file and your address range example:
ddns-update-style none;

option domain-name "blah.net";
option domain-name-servers xx.xx.xx.xx;

subnet 192.168.0.0 netmask 255.255.255.0 {
option netbios-name-servers 192.168.0.1;
option routers 192.168.0.1;
range 192.168.0.250 192.168.0.253;
}

that should get most of the way!!
been doing it this way for years.

H_TeXMeX_H 09-30-2007 03:42 PM

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.


All times are GMT -5. The time now is 03:17 AM.