LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 07-05-2005, 03:43 AM   #1
Ruben2
Member
 
Registered: Sep 2004
Location: Lelystad, NL
Distribution: Debian Etch
Posts: 123

Rep: Reputation: 15
problems setting up my proxy


I'm currently trying to set up a web/mail/ftp/print server using Debian Sarge. My plan is to do it this way:
Internet -- ADSL modem --- Debian server --- router --- my local PCs

I want to do it this way because my router has always a lot of troubles and then it has to be rebooted, which can cause errors when someone is using the server. Another reason is that I can use it now as a firewall for the whole network.

The first thing I had in mind is to conect the server to the router via the WAN slot on the router. But I couldn't fix this because then I've to set my server to give the router an IP-address when the router asks for it. So I thought it might be easyer to connect the server via a normal slot on the router so I could use static IPs. and other computers should be able to connect to the internet by setting the servers ip as proxy address (not gateway because that's what the router is)

Now I have problems with setting the device that connects to internet and the one that connects to the router. The one that connects to the router, eth0, uses a static IP-address. Which works fine (I've tested this by connecting the router to the internet, so the debian server was only connected with eth0).
Than I wanted to set eth1 to connect to the router via DHCP, which it does. But when I want to use internet it doesn't work. I think that this is caused by the thing that Linux thinks eth0 is connected to the internet while that's the one connected to the router. So it should use eth1 to connect to the internet. How can I set this? And if I do that, will the rest of my idea work?
Thanks in advance,
Ruben

EDIT:
I almost forgot to say that I can't swich the cables. I can't use eth0 (a 3com Etherlink III) to connect to the internet and eth1 (an internal card) to connect to the router, because when I try to connect with the 3com card (the eth0) I don't get an IP (via DHCP) from the modem. While I have no problems with connecting when using the internal, eth1, devices. Which is pretty weird IMHO.

Last edited by Ruben2; 07-05-2005 at 03:48 AM.
 
Old 07-05-2005, 07:46 AM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Can you reconfigure your router to use it as a regular switch/hub?
BTW, one of your cables is probably "straight" and the second one "crossover".
 
Old 07-05-2005, 08:41 AM   #3
Ruben2
Member
 
Registered: Sep 2004
Location: Lelystad, NL
Distribution: Debian Etch
Posts: 123

Original Poster
Rep: Reputation: 15
Thanks for replying
Quote:
Originally posted by Emerson
Can you reconfigure your router to use it as a regular switch/hub?
I can give it a try but I guess not, it also supports wireless network and I think that won't work anymore when that was able.
Quote:

BTW, one of your cables is probably "straight" and the second one "crossover".
That can't be the problem, because I tried both cables on both cards, and it was that card (eth0) that didn't work with the modem both times
 
Old 07-05-2005, 12:35 PM   #4
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Wireless is nothing but a wireless access point connected to an Ethernet switch (internally, in your case).
So, you can disable the DHCP in your router and use your Linux box as router. I'm not sure if you can use the WAN port for anything in this scenario, hopefully you have a free Ethernet port for the server (usually these routers have 4 of these).
 
Old 07-05-2005, 02:40 PM   #5
Ruben2
Member
 
Registered: Sep 2004
Location: Lelystad, NL
Distribution: Debian Etch
Posts: 123

Original Poster
Rep: Reputation: 15
I can disable dhcp in my router but I can't disable it's routing function. So I can't use the proxy as a router. I can use it just as a proxy which is fine to me. My current problems are the next ones:

-I don't know how to set the default (the one connected to the internet) ethernet device from eth0 to eth1. I can use eth1 for the internet connection only if eth0 is down, which is pretty unusefull for a proxy :s

-Can I use my box to send an dhcp addres to my router so I can connect it to my WAN port instead of an Ethernet port on it? What other things do I have to configure if I can do that? Do I have to set anything on the router or proxy to let it function fine, or will the router automaticly send anything that comes in via the proxy to the internet?

Thanks in advance,
Ruben
 
Old 07-05-2005, 03:10 PM   #6
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
For adjusting which interface is being used, you should be able to modify the routing table on the Linux machine to move from eth0 to eth1. First, have a look at the routing table to see what the default gateway is currently set to by typing "route". It should display the gateway, IP address, and interface at the end. This will be show eth0 as being associated with the default gateway (where the computer will look for all traffic is doesn't understand - i.e. traffic destined for the Internet). To change the default gateway, type "route add default gw 192.168.1.1 netmask 255.255.255.0 dev eth1", substituting the correct IP address and netmask of your ADSL modem. This should allow eth0 to be enabled, whilst still allowing network traffic out through eth1 to your ADSL modem and the Internet.
 
Old 07-05-2005, 03:25 PM   #7
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Code:
man interfaces
 
Old 07-05-2005, 04:14 PM   #8
Ruben2
Member
 
Registered: Sep 2004
Location: Lelystad, NL
Distribution: Debian Etch
Posts: 123

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by fouldsy
For adjusting which interface is being used, you should be able to modify the routing table on the Linux machine to move from eth0 to eth1. First, have a look at the routing table to see what the default gateway is currently set to by typing "route". It should display the gateway, IP address, and interface at the end. This will be show eth0 as being associated with the default gateway (where the computer will look for all traffic is doesn't understand - i.e. traffic destined for the Internet). To change the default gateway, type "route add default gw 192.168.1.1 netmask 255.255.255.0 dev eth1", substituting the correct IP address and netmask of your ADSL modem. This should allow eth0 to be enabled, whilst still allowing network traffic out through eth1 to your ADSL modem and the Internet.
Thanks that helped me very well I haven't had time to test it if it works as a proxy but I can now access internet from the server itself

Last edited by Ruben2; 07-05-2005 at 04:23 PM.
 
Old 07-06-2005, 04:47 AM   #9
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
Glad that it got running. To act as a proxy, you'll probably need to play with iptables, of which there are tons of resources on the Internet. At least the server will now know which device to use for internal network traffic and for Internet traffic. Have fun!
 
Old 07-06-2005, 07:29 AM   #10
Ruben2
Member
 
Registered: Sep 2004
Location: Lelystad, NL
Distribution: Debian Etch
Posts: 123

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by fouldsy
Glad that it got running. To act as a proxy, you'll probably need to play with iptables, of which there are tons of resources on the Internet. At least the server will now know which device to use for internal network traffic and for Internet traffic. Have fun!
Yeah, I'm glad too I got it now working as a proxy, even with the gateway idea I just had to set the DNS for my PCs as the routers ip and the gateway as the servers' ip. And with the proxy file from aboutdebian.org (http://www.aboutdebian.com/proxy.htm) I can access the internet from my PCs'.
There are still a couple of problems: I can't use any chat program, no msn and no aim. And I can't access gmail from my browser, though my gmail plugin in firefox can see if there are new messages. What can cause this problem? is it an error in the proxy script (the one from http://www.aboutdebian.com/proxy.htm)?
Thanks in advance,

Ruben

EDIT: Gmail isn't the only page that can't be found when my proxy is on. I can't access hotmail.com and elderscrolls.com either. And I think there are more pages that won't be found when I try to access them.

EDIT2 (sorry for so much edits): I just checked the monitor of my server (which is connected because the server is in development) and it has a whole list of the following sentence:
Code:
MASQUERADE: Route sent us somewhere else.
I think this has something to do with the problem, but I don't know what.
Sometimes there just comes another line to the list with the same sentence. Even now, when I'm just typing this so I'm not loading a page a new line is added. What can it be?

Last edited by Ruben2; 07-06-2005 at 07:41 AM.
 
Old 07-06-2005, 10:58 AM   #11
Ruben2
Member
 
Registered: Sep 2004
Location: Lelystad, NL
Distribution: Debian Etch
Posts: 123

Original Poster
Rep: Reputation: 15
Now the proxy don't work ok anymore
I disconnected it because not all the sites worked. But when I do ifup eth1 now I get an message. This message is only showed on the monitor connected to the server and not on my ssh shell. This is just like the MASQUERADE I talked earlyer about: it shows up on the server monitor, not on the ssh shell. It even shows up there when I give the command via ssh. The current message is this one:
Code:
eth1: Setting half-duplex based on MII #1 link partner capability of xxxx
xxxx differs, when I do ifup eth1 xxxx is 41e1, but when I unpug the cable out the modem (to plug the one of the router in, so I can use internet) xxxx is 0000. I also had once that xxxx 0081 was, but I don't know when that one happened.

I really don't know what this error means :s. What I do know is that the proxy don't work ok anymore: I can access the setup of my modem (which had an reset exidently when there was a no power for some minutes: I hadn't saved everything forever yet :s) but I can't access any internet page. What do I have to do?
Thank in advance,
Ruben
 
Old 07-07-2005, 04:23 AM   #12
Ruben2
Member
 
Registered: Sep 2004
Location: Lelystad, NL
Distribution: Debian Etch
Posts: 123

Original Poster
Rep: Reputation: 15
Does noone has any idea what to do?
 
Old 07-07-2005, 05:07 AM   #13
fouldsy
Senior Member
 
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
Not too sure to be honest, but are you sure your network cables are OK? Try replacing the cables, as I'm pretty sure it shouldn't be half-duplex and differing speeds (if I understood your post correctly!).
Also, as a test, try flushing your firewall, "iptables -F" which clears all rules, then try accessing the sites you were having problems again from the server. Then try setting your rules up again. It looks like your rules weren't set correctly. Something like:

modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
iptables -A FORWARD -j ACCEPT

will allow your server to forward all traffic to the Internet from any of your internal machines, assuming your network interfaces are configured as discussed before. Those basic rules are off the top of my from what I have running at home, so I could be wrong on syntax!
 
  


Reply



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
Firefox with Proxy setting wardialer Linux - Newbie 2 11-14-2004 08:49 PM
Proxy Setting pakuson Linux - Networking 2 08-13-2004 06:54 AM
Proxy setting in Mandrake? catastrophic Linux - Networking 0 08-10-2004 04:10 AM
setting proxy precioso77 Linux - Networking 1 09-14-2003 07:22 AM
setting up proxy Nokturnity Linux - Networking 3 07-23-2003 02:26 AM

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

All times are GMT -5. The time now is 08:54 AM.

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