PDA

View Full Version : Port Forwarding from WRT54G to machine running FC6?


axiopisty
2007-10-27, 12:50 PM CDT
Hi,

When I start my computer running FC6 my WRT54G router assigns it a random IP address of 192.168.1.x. I want to run a web server on that machine with DynDNS. So I have to forward the ports on the router to that machine.

The problem I am having occurred after I configured the port forwarding on the router. When I configured port forwarding the Server was assigned the IP address 192.168.1.1. When I restarted the Server, the router assigned it IP address 192.168.1.2. So now the Server is not receiving the port forwarded HTTP requests.

Do you know of a feature in FC6 that will allow the server to specify a static IP address to use from the router? Windows XP has this feature. All I have to do is open “Internet Protocol (TCP/IP) Properties” and configure the machine to “Use the following IP address” rather that “Obtain an IP address automatically.”

Eagerly awaiting knowledge from the guru!
Axiopisty

glennzo
2007-10-27, 03:04 PM CDT
The router's address should be 192.168.1.1 I have the same router and it's always that way. The starting ip address can be 192.168.1.2 with a pool of 150 ip addresses. On mine the starting ip address is 192.168.1.100 with a pool of 150 so I have 192.168.1.100 to 192.168.1.250. My Linux boxes are DHCP but they always get the same ip address. I use DynDns for my Wiki and it always works. There's no need for a static ip address here. You can assign a static address through System > Administration > Network if need be.

stevea
2007-10-27, 04:50 PM CDT
You need to assign a fixed IP address to the server system. The wrt54g *should* allow you to do this,
but sadly it doesn't.

Let me suggest immediately that you consider using one of the alternative firmware sets for your router.
*Most* wrt54g's run a linux 3.4 kernel (tho' some recent models use WindRiver's VxWorks). The linux based ones can be upgraded to 3rd party distro firmware with much improved features. I use this on a pair of wrt54xx's
but there are other and arguably better wrt distros.
http://www.dd-wrt.com/dd-wrtv2/index.php
The dd-wrt allows you to create static IP assignments and then correctly re-serves the local lan names via dns (unlike the oem firmware).

No matter; If you can't, or choose not to upgrade the wrt firmware then you can do this ...
You'll have to manually configure your server system (system-config-network) and use a fixed IP
address like 192.168.1.1 and also set the dns server to point to your router (by IP address).
Then on the router set it to server addresses 192.168.1.2 and above.

axiopisty
2007-10-27, 04:55 PM CDT
glennzo,

Thank you for your reply. You're right, 192.168.1.1 is the address of the router. The addresses the server had were 192.168.100 and 192.168.101.

Even if the router 'usually' assigned the same IP address to all the devices behind it, it is not guarenteed to assign the same IP to the same device every time. I have multiple computers behind the router. So when I start them they don't always get the same IP. My original question still applies.

Do you know of a feature in FC6 that will allow the server to specify a static IP address to use from the router? Windows XP has this feature. All I have to do is open “Internet Protocol (TCP/IP) Properties” and configure the machine to “Use the following IP address” rather that “Obtain an IP address automatically.”

Does anyone know how to do this on FC6?

Thanks,
Axiopisty
PS. Wouldn't it be nice if you could specify port forwarding by MAC address? That would solve all my problems!

Iron_Mike
2007-10-27, 05:24 PM CDT
Hi,

When I start my computer running FC6 my WRT54G router assigns it a random IP address of 192.168.1.x. I want to run a web server on that machine with DynDNS. So I have to forward the ports on the router to that machine.

The problem I am having occurred after I configured the port forwarding on the router. When I configured port forwarding the Server was assigned the IP address 192.168.1.1. When I restarted the Server, the router assigned it IP address 192.168.1.2. So now the Server is not receiving the port forwarded HTTP requests.

Do you know of a feature in FC6 that will allow the server to specify a static IP address to use from the router? Windows XP has this feature. All I have to do is open “Internet Protocol (TCP/IP) Properties” and configure the machine to “Use the following IP address” rather that “Obtain an IP address automatically.”

Eagerly awaiting knowledge from the guru!
Axiopisty

There is a function in most routers, it is called the DMZ, usually under the gaming/application tab of the router configuration. It will allow you to set static ip's exposed to the WAN side and leave the LAN side with DHCP intact addresses intact...Once set it will work the port forwarding scheme since the IP for the DMZ box will not change....

stevea
2007-10-27, 05:35 PM CDT
The router's address should be 192.168.1.1 I have the same router and it's always that way.

No it's not always that way. You can set it to anything you like, the the RFCs suggest you NOT use x.x.x.0 and x.x.x.255 (tho' these are legal).. Generally you should use a private address range (192.168.x.x/24, 172.x.x.x/16 or 10.x.x.x.

My Linux boxes are DHCP but they always get the same ip address.

That's just a matter of luck. If you gave me 15 minutes on your lan I could break that behavior. You can't and shouldn't count on a dynamic address being the same.

You can assign a static address through System > Administration > Network if need be.
That is what you need, but you my impression is that it's inefffective in dhcp assignment and local names aren't re-served via dhcp.

axiopisty
2007-10-28, 12:14 AM CDT
Hey guys,

Thanks for everyone who is participating in this thread. I found what I was looking for. I didn't find it until stevea advised me about system-network-config. I really should have found this before I posted the thread.

Anyway, what I found is that in FC6, in a KDE session, you can click on the k menu, then go to System -> Network Device Control, and then configure the device (in my case, eth0) to be a static IP address, exactly like the one on a Windows XP box. When I did this, I also had to configure the DNS to point to the router. But its all working now and I have my server configured the way I want it so I can now use the port forwarding on the router to get to the server.

...and local names aren't re-served via dhcp.

What I understand by what stevea said is that just because I have configured my server to use a static IP address doesn't mean that the router (serving IP addresses via DHCP) will reserve that address. If the server is set at 192.168.1.100, and while the server is shut down, some other device connects to the router, the router could assign 192.168.1.100 to that device. Then, when I turn my server on there would be an IP address conflict with the other device on the network. So it's not very reliable. Is that what you mean stevea?

If this is the case, I think it is typical for the router to assign one of the lowest available IP addresses to a device that connects to it. Is that right? Would it be safer to make the static IP address be something like 192.168.1.150 so if other devices connect to the network when the server is shut down they get the lower IP addresses, and 192.168.1.150 would probably be available for the server?

Thanks to all,
Axiopisty
PS. I've never had such a great experience with forums like I have on FedoraForum.org. I think its awesome that so many knowledgable people are willing to devote some of their time to helping others with their computer problems. You all rock!

scottro
2007-10-28, 06:15 AM CDT
I do exactly what you're suggesting. I have a Linksys (as do you) although it's not wireless. It's default address is 192.168.1.1, which is pretty standard (that is, routers usualy have x.x.x.1).

Its default pool of addresses start at 100--actually, I changed that at some point to start at 102, I think. I don't remember why--if I were doing it now, I would have left it alone, and simply given my server a lower address.

So, yes, simply give your server and anything else, such as a printer connected by ethernet, a static address below 100. Then have the router forward requests to the proper address.

johannlo
2007-10-28, 06:45 AM CDT
??? mate just give your PC a static IP, exactly the same as windows, GUI (system menu) or command line its all good.....

tip: you can edit a text file directly from CLI that controls the behaviour of your network card whenever its brought up. There should be a file called ifcfg-<name of interface> in /etc/sysconfig/network-scripts. Here is mine, where you can clearly see the static IP assignment.

DEVICE=eth0
BOOTPROTO=none
HWADDR=00:16:E6:84:A2:0B
ONBOOT=yes
TYPE=Ethernet
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
USERCTL=no
IPV6INIT=no
PEERDNS=yes

Using 'DMZ mode' on a WRT54G basically means all ports will be forwarded just like the box had a direct internet IP and was getting everything routed to it without any filtering. This is pretty dangerous unless you set it up so there is an internal firewall the DMZ machine has to go through before hitting your LAN.... with port forwarding, you are only opening up specific ports for the specific machines you define your rules for.

As for DHCP static assignments, it is possible but I can't remember how to do it on the WRT54G factory firmware. There should be a way of creating static bindings (e.g. always give XYZ mac address the same IP of xxxx) - if you flash it with say DD-WRT firmware the option will be there (this is what I run). This is useful for say if you want to port forward to a laptop, but you don't want to be having to constantly change the laptop's network settings because normally you want it left on DHCP as you'll be connecting it to many different places. Its also a more 'elegant' way of doing it as all your IP assignments can then be administered from one place / one box.

marcrblevins
2007-10-30, 12:52 AM CDT
I use a 3Com router, that is my DHCP. on my router's "DHCPClients List", I have a checkbox column called "Fixed Association". When its checked per IP address, it assigned that IP address to the shown Host Name everytime.

Not bragging, just wondering if you have that "fixed association" thingy on your router brands.

johannlo
2007-10-30, 02:14 AM CDT
You can flash the firmware of the WRT54 very easily, DD-WRT will give you that functionality + a whole load more (mounting samba shares, sending syslogs, SNMP, primitive Quality of Service, VPN passthrough + PPTP server, VLANs, ability to weak more wireless settings such as power, etc. - plus its linux based and you get a linux CLI :) )