LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-20-2006, 10:48 AM   #1
HmmLinux
Member
 
Registered: Apr 2003
Location: Stockholm, Sweden
Distribution: Debain
Posts: 59

Rep: Reputation: 15
where did I go wrong?


I'm trying to get my Debian box to work as a router for my laptop with XP Pro and for my stationary that has dual boot with XP Pro and Debian, but it aint working. It's working up to layer two, because I can ping between them and they're all showing up in the arp table.

This is how the router is setup:
/etc/network/interfaces
Code:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
address 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255

auto eth2
iface eth2 inet static
address 192.168.0.24
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
I've tried with different broadcast addresses for eth1 and eth2, dont know if eth1 and eth2 are suppose to have the same broadcast address, which is it? What's the highest and the lowest address I can have as broadcast address? What is the highest IP address I can have when the lowest is 192.168.0.1?

The routers /etc/hosts
Code:
127.0.0.1 localhost.localdomain localhost gardian
192.168.0.94 Active #stationary hostname and IP
Am I suppose to add the windows workgroup name which is azagod.net to /etc/hosts and change the routers domain too? so /etc/hosts will look like:
Code:
127.0.0.1 gardian.azagod.net
192.168.0.94 Active.azagod.net
I want azagod.net to be the local networks domain name. What should I do to create my own domain if this doesn't work? which files needs to be changed on the router so I wont get the error message when I try to change it on the windows machines? now it only works with azagod.net as workgroup name on the windows box.

Router /etc/hosts.allow
Code:
ALL: 192.168.0.0/255.255.255.0
That's the only files I have altered on the router.
Every time I boot up the router I have to run: echo "1" > /proc/sys/net/ipv4/ip_forward. If I create a new file that looks like this:
Code:
#!/bin/sh
/proc/sys/net/ipv4/ip_forward
and save it as ip_fw in lets say /usr/sbin. Then I'm suppose to put /usr/sbin/ipfw in a file, which I dont remember the name and the location of, but then it will be run automatically at boot. I'm on the right way? If so, which file is it?

What I've done with the stationary windows macine:
C:\WINDOWS\system32\drivers\etc\hosts
Code:
127.0.0.1 localhost
192.168.0.1 gardian #the router
C:\WINDOWS\system32\drivers\etc\networks
Code:
loopback 127
azagod.net 192.168.0.0 # workgroup name and network address
windows stationary addresses
Code:
ip-address 192.168.0.94
netmask 255.255.255.0
standard-gateway 192.168.0.1
DNS-server X.Y.X.Y # not my real DNS-server address
DNS-server2 X.X.X.X
Got the DNS-server address from /etc/resolv.conf

Then I created this iptables script as /etc/init.d/iptables.sh:
Code:
#!/bin/sh

iptables -F
iptables -t nat -F
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
I'm just getting started reading Iptables Tutorial 1.2.0 so I dont know how this script is working with a dynamic internet IP address.

After that I did a chmod:
Code:
chmod 755 /etc/init.d/iptables.sh
to make it start at boot:
Code:
ln -s /etc/init.d/iptables.sh /etc/rc1.d/S99iptables
och
ln -s /etc/init.d/iptables.sh /etc/rc2.d/S99iptables
to activate it:
Code:
cd /etc/init.d
./iptables.sh
I've followed a tutorial on the Swedish linux forum made by Ekenstein. Hope other ppl can se this thread and make an easy start on how to set up a router. But some where I made an mistake and I dont know where. If I have missed to leave any info, let me know and I'll fill out the blanks. Now where did I do wrong... Have I missed any software that needed to be installed exept for iptables? Any clues or ideas for an upgrade?

Last edited by HmmLinux; 03-20-2006 at 10:58 AM.
 
Old 03-21-2006, 03:57 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Well I don't really see a fundamental question there... those two NIC's are on the same network, therefore there is no routing taking place, it's just going to bridge your network, and if you can ping one ip from the other then that's the job done... personally if you do want to keep them on the same subnet then please please just go spend $10 on a switch.
 
Old 03-21-2006, 06:39 PM   #3
HmmLinux
Member
 
Registered: Apr 2003
Location: Stockholm, Sweden
Distribution: Debain
Posts: 59

Original Poster
Rep: Reputation: 15
the client cant access the net so it's not done and why and how to fix it is the big question. i've changed the network addresses to:
Code:
eth1
address 192.168.0.1
network 192.168.0.0

eth2
address 192.168.1.1
network 192.168.1.0
whats the fun in buying a switch? im doing this because i want to learn how to. thanks for the tip buying a switch, hope other ppl find you more helpfull then i did. if i want to use VLSM and keep it on the same network, would that be possible? does debian have an supporting routing protocol? Chris, feel free to answer but please please please say something that will help me learn more.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What's wrong with this? anuode Solaris / OpenSolaris 4 09-19-2005 01:01 PM
What's wrong ? igor@44 Programming 8 08-10-2005 04:36 AM
Something is VERY WRONG MontyPY Linux - Software 4 03-04-2005 06:25 PM
my time is wrong and calender is also wrong Paxmaster Linux - General 6 12-16-2004 12:46 AM
What's wrong with RH 9? kavelj Linux - Distributions 4 07-17-2003 02:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration