Setting up a static I.P. address
How do I set up a static I.p. on my box in order to forward port requests?
|
Are you using a cable/dsl router?
If so do you know the IP you use to connect to your router from the lan side? If you do then do this. If it is say 192.168.1.1 then you want to use and ip like 192.168.1.10 with a subnet of 255.255.255.0 and a gateway of 192.168.1.1. For you DNS you could use your routers IP or your providers DNS numbers. The numbers the router sees on the wan side. Once done then you can port forward to the internal lan PC. Brian1 |
Right but how do I change that in Linux?
|
I want my ip to be lets say 192.168.1.234 what would I edit to make it defualt to that on startup.
|
What distro and Gui are you using? There is problably a nice gui tool to do this.
For now post your /etc/sysconfig/network-scripts/ifcfg-eth0. Here is a basic example that should work for you. Code:
DEVICE=eth0 /sbin/ifconfig eth0 down edit your ifcfg-eth0 file. Save and Exit edit /etc/resolv.conf and add either your providers DNS numbers or use the router's IP. Save and Exit. nameserver 192.168.1.1 /sbin/ifconfig eth0 up /sbin/ifconfig eth0 to see if looks correct. Brian1 |
#su
#nano /etc/network/interfaces Once that opens, delete what you see and enter: auto eth0 iface eth0 inet static address 192.168.1.101 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 Make your own changes to the IP address. |
Ok first I am running RH9 and my vim /etc/sysconfig/network-scripts/ifcfg-eth0
is Code:
DEVICE=eth0 |
So from what I read I made this my eth0
Code:
DEVICE=eth0 |
IP address is to incorrect for IPv4 format. You can only have values from 1-255. Normally 255 is reserved for broadcast. So your IP of 192.168.1.281 will not work it needs to be 192.168.1.2-254. Also bootpront needs to be none not dhcp. If a standard store bought router then make broadcats 192.168.1.255.
Just copy the contents of my upper post to your ifcfg-eth0. Before doing this run the command ' ifdown eth0 ', edit ifcfg-eth0, then run ' ifup eth0 ' From what I have read you want it to look like this: Code:
DEVICE=eth0 Brian1 |
Thanks for that really helpfull works great
:) |
Hey how do you setup the DNS on this setup?
|
anyone help me with setup up my DNS setup on linux?
|
you need to add a DNS IP to /etc/resolv.conf
seems most routers will forward DNS provided dynamically by the isp, so you simply use the router address. If the router is at 192.168.1.1, this line, and perhaps the only line, should be in your /etc/resolv.conf nameserver 192.168.1.1 For more, http://www.linuxquestions.org/questions/answers.php?action=viewarticle&artid=26 at the top of the Linuxquestions.org pages, there's an "answers" button, many many excellent articles in there. |
sweet that works perfect
using DHCP now |
All times are GMT -5. The time now is 03:09 AM. |