PDA

View Full Version : Linux Questions


Nunnehi
02-16-2002, 04:38 AM
Hello

I'm a non-certified 2000 Admin, and I'm trying to learn linux. From what I've gathered up(from various sites), I believe I can generate a LAN, and NAT the connection together. I would like some input on this:

Keep in mind that I have already set a static IP address to eth0.

The IP address (LAN)blocks I want are:

Linux Server: 10.0.1.1
IP Blocks: 10.0.1.2-10.0.1.253
Subnet Mask: 255.0.0.0
Gateway: 10.0.1.254

The external Internet IP is handled via PPP, and it is dynamic.

Question #1: Do I setup eth0's gateway to 10.0.1.254?

-----------------

Please run through these steps/commands and tell me if they are correct:

(the clients are windows machines)
"route add 255.255.255.255 dev eth0"
*edit /etc/dhcpd.conf*
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.0.0.0;
option broadcast-address 10.0.1.255;
option routers 10.0.1.254;
option domain-name-servers (external dns), (external DNS);
option domain-name "matrix.local" ;

subnet 10.0.1.0 netmask 255.0.0.0 {
range 10.0.1.2 10.0.1.253;
}
*save, exit*

"touch /var/state/dhcp/dhcpd.leases"

"ipchains -A input -s 10.0.1.0/24 -p TCP -j REDIRECT"
"ipchains -P forward -s 10.0.1.0/24 -j MASQ"

*edit /etc/sysconfig/network*
*change FORWARD_IPV4=false to true*
*exit*
*reboot*

goto Windows machines and setup DHCP.

Will this work, or am I missing steps?

madborg
02-21-2002, 02:22 PM
you are way ahead of me on that network stuff. I keep my linux and windows behind a simple little box. I tried setting up network stuff and really got all confused and that was before NAT.

I was going to use my linux as a network router, but the reason why is clearly shown in your posting -- I don't know what to do and apparently I can even understand it after I see it.

TheClaus
02-22-2002, 04:40 AM
Actually Linux is very easy to setup for NAT and Firewall. Here is my setup. Rehat 7.1 no custom kernel

Linux box has 2 nics. ETH0 is connected to cablemodem, ETH1 is connected to my HUB.

ETH0 is running both DHCP Server on ETH1 and DHCP Client on ETH0.

For the DHCP client on ETH0 I just told it DHCP. It found my ip from my cablemodem and was all set. Could access the internet and everything from linux. One thing to note is that when I had a hostname that had to be added it wouldn't work unless I edited my ifup file and forced it to my hostname.

For DHCP server on ETH1 I just used this step by step webpage I found on the web. http://dcfonline.sfu.ca/ying/linux/dhcpd/index.html

This webpage is for RH6.0 but works in all rehats above and even other linux distros. Just make sure you touch the leases file whereever it needs to be.

For NAT and firewall I found a sweet program called gSheild. http://muse.linuxmafia.org/gshield.html

Just follow the directions and your set. It will setup NAT for you and also is a great firewall. DSLReports said my computer was secure. It is also very easy to use if you want to setup servers cause you just go into the conf file and set the service you want from NO to OPEN or FORWARD. You'll understand it when you see it but it is great.

Now just setup all your computers to DHCP and your set. This works great for me as my laptop I use for work is setup for DHCP and I can easily move it from work to home and still do internet stuff.

Hope this helps out. If you need to you can PM me or just reply. I would be glad to help out.

*edited to add the DHCP all computers

Pyrotek
02-22-2002, 05:51 AM
The only problem I can see there is your mask. Did you intend to use 10. as a class A net? If you're only using 254 hosts i'd use 255.255.255.0.

Nunnehi
02-23-2002, 05:49 AM
That's what it is... I was wondering why dhcpd freaked out when I tried to add the hostmask of 255.0.0.0 with the IP blocks i gave it. Basically it spit them back at me. With windows 2000, it isn't picky on the subnet, and to my understanding, you put 255.0.0.0 with the 10.x.x.x IPs. *shrug*

It's currently running just fine, but I'm using 192.168.1.x and I hate using 192 ip blocks

I'll try 255.255.255.0 and see if it works ;)

Thanks Pyrotek.