LinuxQuestions.org
Help answer threads with 0 replies.
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 10-07-2005, 08:59 PM   #1
partyk1d24
Member
 
Registered: Jun 2005
Location: Orlando, Fl
Posts: 41

Rep: Reputation: 15
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?
 
Old 10-07-2005, 09:07 PM   #2
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
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
 
Old 10-07-2005, 09:11 PM   #3
partyk1d24
Member
 
Registered: Jun 2005
Location: Orlando, Fl
Posts: 41

Original Poster
Rep: Reputation: 15
Right but how do I change that in Linux?
 
Old 10-07-2005, 09:13 PM   #4
partyk1d24
Member
 
Registered: Jun 2005
Location: Orlando, Fl
Posts: 41

Original Poster
Rep: Reputation: 15
I want my ip to be lets say 192.168.1.234 what would I edit to make it defualt to that on startup.
 
Old 10-07-2005, 09:54 PM   #5
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
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
BOOTPROTO=none
BROADCAST=192.168.1.255
# HWADDR=00:90:F5:0D:2F:85
IPADDR=192.168.1.234
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes
TYPE=Ethernet
GATEWAY=192.168.1.1
USERCTL=no
PEERDNS=yes
IPV6INIT=no
If you have something similiar then as root in a terminal session run the following commands: (Note make a backup of the file before changing)

/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
 
Old 10-07-2005, 10:55 PM   #6
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 73
#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.
 
Old 10-07-2005, 11:23 PM   #7
partyk1d24
Member
 
Registered: Jun 2005
Location: Orlando, Fl
Posts: 41

Original Poster
Rep: Reputation: 15
Ok first I am running RH9 and my vim /etc/sysconfig/network-scripts/ifcfg-eth0
is
Code:
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
What all should I add?
 
Old 10-07-2005, 11:30 PM   #8
partyk1d24
Member
 
Registered: Jun 2005
Location: Orlando, Fl
Posts: 41

Original Poster
Rep: Reputation: 15
So from what I read I made this my eth0

Code:
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
#here on down is my work
BROADCAST=192.168.1.241
IPADDR=192.168.1.281
NETMASK=255.255.255.0
NETWORK=192.168.1.0
TYPE=Ethernet
GATEWAY=192.168.1.1
What else should I need or is this ok? and do I have to restart any processes?
 
Old 10-08-2005, 03:53 PM   #9
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
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
BOOTPROTO=none
onBOOT=yes
#here on down is my work
BROADCAST=192.168.1.255
IPADDR=192.168.1.234
NETMASK=255.255.255.0
NETWORK=192.168.1.0
TYPE=Ethernet
GATEWAY=192.168.1.1
Hope this helps.
Brian1

Last edited by Brian1; 10-09-2005 at 06:04 PM.
 
Old 10-23-2005, 11:20 AM   #10
namit
Member
 
Registered: Aug 2005
Distribution: Debian
Posts: 355

Rep: Reputation: 30
Smile

Thanks for that really helpfull works great

 
Old 10-27-2005, 12:32 PM   #11
namit
Member
 
Registered: Aug 2005
Distribution: Debian
Posts: 355

Rep: Reputation: 30
Hey how do you setup the DNS on this setup?
 
Old 10-30-2005, 08:14 AM   #12
namit
Member
 
Registered: Aug 2005
Distribution: Debian
Posts: 355

Rep: Reputation: 30
anyone help me with setup up my DNS setup on linux?
 
Old 11-20-2005, 10:20 PM   #13
TenEighty
Member
 
Registered: Oct 2004
Location: Vancouver, B.C., Canada
Distribution: Kubuntu
Posts: 57

Rep: Reputation: 15
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.

Last edited by TenEighty; 11-20-2005 at 10:23 PM.
 
Old 12-29-2005, 07:23 AM   #14
namit
Member
 
Registered: Aug 2005
Distribution: Debian
Posts: 355

Rep: Reputation: 30
sweet that works perfect
using DHCP now
 
  


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
Static IP address mikz Slackware 4 11-28-2005 05:30 PM
How to set a static IP address? dx0r515t Slackware 12 04-17-2005 02:33 PM
setup the static ip address hansi umayangan Suse/Novell 1 04-04-2005 03:54 AM
Getting static IP address etc. chapzilla Linux - Newbie 2 06-16-2003 12:40 PM
Static IP Address bytebrowser Linux - Networking 14 06-16-2003 07:36 AM


All times are GMT -5. The time now is 01:34 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration