LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 10-10-2010, 07:14 PM   #1
scotty2024
LQ Newbie
 
Registered: May 2010
Posts: 17

Rep: Reputation: 0
Question Static IP address


Hi, I am trying to open some ports for port forwarding. I believe I need a static IP address for this. Something like 192.168.1.x. How can I see if I currently have one or not. If not, how do I set it?

I have read that /etc/network/interfaces needs to be edited. Not sure what needs to be changed though. Here is my current file.
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
Thanks.
 
Old 10-10-2010, 07:59 PM   #2
ionrivera
Member
 
Registered: May 2010
Distribution: Debian, RHEL, AIX, Solaris, HP-UX
Posts: 61

Rep: Reputation: 4
In your case, your network interface is set for dhcp. To acquire a static IP address... follow this example:

On debian based system:
# vi /etc/network/interfaces

Code:
auto eth0
iface eth0 inet static
address 192.168.1.10
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1

Last edited by ionrivera; 10-10-2010 at 08:17 PM.
 
Old 10-10-2010, 08:00 PM   #3
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
http://www.techiecorner.com/486/how-...-ip-in-debian/
 
Old 10-10-2010, 08:07 PM   #4
scotty2024
LQ Newbie
 
Registered: May 2010
Posts: 17

Original Poster
Rep: Reputation: 0
So then, using the example above, I would use 192.168.0.42 as the address to forward the port to? Do I have to do anything with the network, netmask, broadcast, or gateway?
 
Old 10-10-2010, 08:24 PM   #5
ionrivera
Member
 
Registered: May 2010
Distribution: Debian, RHEL, AIX, Solaris, HP-UX
Posts: 61

Rep: Reputation: 4
Thumbs up

are you trying to setup port forwarding on a router?

Last edited by ionrivera; 10-10-2010 at 08:25 PM.
 
Old 10-13-2010, 11:21 PM   #6
scotty2024
LQ Newbie
 
Registered: May 2010
Posts: 17

Original Poster
Rep: Reputation: 0
Yes I am trying to set up port forwarding on a router. I am trying to do it on my debian machine and don't know the equivalent command for "ipconfig". How do I find my debian's ip address? Do I have to set the static ip address? 192.168.1.???

I am confused because I want other computers from outside my network to connect to it. So I thought I had to use my public ip. But I now believe that I use the debian's IP address and the outside computers connect using the public ip and then the router directs them to the debian machine. Is that right?

Last edited by scotty2024; 10-13-2010 at 11:22 PM.
 
Old 10-14-2010, 07:14 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by scotty2024 View Post
Yes I am trying to set up port forwarding on a router. I am trying to do it on my debian machine and don't know the equivalent command for "ipconfig". How do I find my debian's ip address? Do I have to set the static ip address? 192.168.1.???

I am confused because I want other computers from outside my network to connect to it. So I thought I had to use my public ip. But I now believe that I use the debian's IP address and the outside computers connect using the public ip and then the router directs them to the debian machine. Is that right?
ifconfig

Yes, you have to set a static IP (unless you have a sophisticated router that accepts DNS name requests from DHCP clients and can do port forwarding by DNS name -- but let's keep this simple).

ionrivera has given the file name and sample contents to set a static IP. You need to use an editor to, er, edit it. vi is popular but nano is simpler; there are others. The file should be editable only by root.

Only your public IP is visible from the Internet so, yes, you must use port forwarding on the router to route incoming packets to the debian machine on your LAN. It is more secure to forward only the ports that need forwarding such as 80 for HTTP.
 
  


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
Static ip address rust8y Solaris / OpenSolaris 1 09-18-2009 02:33 AM
? about static ip address 200mg Linux - Newbie 3 11-06-2008 01:12 PM
Set IP address to static from DHCP assigned address jborn Linux - Networking 4 02-02-2007 08:38 PM
[SOLVED] Converting static IP-address to dynamic IP-address Blue_Ice Linux - Networking 3 07-20-2006 03:35 AM
Getting static IP address etc. chapzilla Linux - Newbie 2 06-16-2003 11:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 06:28 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