LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 03-14-2005, 10:02 PM   #1
cd1680
Member
 
Registered: Mar 2005
Posts: 40

Rep: Reputation: 15
how to set a static ip address or do port forwarding?


hi i am new to linux.
i just started using fedora 3 a week ago.
i just installed azureus and keep getting the NAT error for port 6881. i do not know how to configure the port forwarding on my system. and also do i have to make my ip address static? (i hav used windows xp for a long time and know this is something that i must do in win xp)

any help would be greatly appreciated. thanks alot.
 
Old 03-14-2005, 10:21 PM   #2
biniar
Member
 
Registered: Jan 2004
Location: Michigan
Distribution: FreeBSD
Posts: 49

Rep: Reputation: 15
Are you running a router?

Forward the port from there if youare in this situation for your internal ip address.

Hope that helps...
 
Old 03-14-2005, 11:17 PM   #3
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
what does your network look like? router? firewall? stuff like that would be required to answer your question.
 
Old 03-15-2005, 07:59 PM   #4
cd1680
Member
 
Registered: Mar 2005
Posts: 40

Original Poster
Rep: Reputation: 15
i have a router. linksys brand. my computer is connected to that router. i am using DHCP or something like that to connect.
also i just installed firestarter
i have selinux enabled.
thanks

Last edited by cd1680; 03-15-2005 at 08:00 PM.
 
Old 03-15-2005, 08:51 PM   #5
mcd
Member
 
Registered: Aug 2003
Location: Boulder, CO
Distribution: Slackware, RHEL, CentOS
Posts: 825

Rep: Reputation: 33
to log into your router, type 192.168.1.1 into your browser and try username: admin, passwd: (blank) or guest, admin, some combination thereof. or maybe it's something you set yourself. anyway, you should be able to figure out port forwarding from there...you just need to know the port number and the ip address you want stuff sent to. while you're in there, confirm that your router is acting as a dhcp server, and nose around your dhcp clients table, etc to get a feel for which computer is which, and all that.

then i would go back in to set up your connection in linux. don't know FC at all, there's probably a nice GUI to do the work for you, but if you have a file called rc.inet1.conf (should be in /etc/rc.xxxx/rc.inet1.conf or something), use vim or emacs or another text editor to open the file and put in your settings. for instance:

# Config info for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
DHCP_HOSTNAME=""

...

# Default gateway IP address:
GATEWAY="192.168.1.1"


so...if you're using dhcp then you probably just need to add that "yes" after use_dhcp. if you don't use it, put no, and instead enter your static ip address in IPADDR. you may also need to specify your default gateway as 192.168.1.1 (i had to do this for static ip, but not dhcp).

you can see if it worked by typing the following commands as root:

/etc/rc.d/rc.inet1 stop
/etc/rc.d/rc.inet1 start

(change the location if it's in a different place).
 
Old 03-16-2005, 06:53 PM   #6
cd1680
Member
 
Registered: Mar 2005
Posts: 40

Original Poster
Rep: Reputation: 15
i got confused by your explanation.
i did understand the first part and configured port forwarding for port 6881.
but i dont know what to do next. i am trying to get azureus to work. it is using port 6881 and every time it gives a NAT error when i try to test it.
 
Old 03-16-2005, 07:24 PM   #7
mcd
Member
 
Registered: Aug 2003
Location: Boulder, CO
Distribution: Slackware, RHEL, CentOS
Posts: 825

Rep: Reputation: 33
sorry, i misunderstood you i think. the second part was how to get dhcp working, or how to assign a static ip if you don't use dhcp. but it sounds like you already have an ip address and can connect to the internet, so the rest of what i wrote isn't helpful.

unfortunately i don't know what azureus is, but you should check to see if you have a firewall enabled, and if you do you need to open port 6881 on the firewall (as well forwarding it from the router). again, i know how to do it manually through iptables...but i'm sure FC gives you a GUI. do you remember installing or configuring a firewall?

also, if you open a terminal, type

su

and enter the root password to change to superuser. then type

netstat -anp

and it will list all the ports your computer is listening to (ie which services are running and which ports they need open). when you find your firewall, make sure any port netstat says you're listening on is open (assuming that you *want* that service running!).
 
Old 03-16-2005, 08:19 PM   #8
cd1680
Member
 
Registered: Mar 2005
Posts: 40

Original Poster
Rep: Reputation: 15
i just installed firestarter as a gui firewall
and i tried opening the port from there but it still says NAT error?
do i have to disable firewall or something? or do i have to enable linux forwarding ?
 
Old 03-16-2005, 08:43 PM   #9
mcd
Member
 
Registered: Aug 2003
Location: Boulder, CO
Distribution: Slackware, RHEL, CentOS
Posts: 825

Rep: Reputation: 33
is NAT error related to resolving ip addresses? like a nameserver? i had to allow outbound access to udp port 53 in order to get sendmail working properly (i guess that's the port used for DNS resolution). you could also check /etc/resolv.conf and see what's in there. did you try the netstat -anp tip to find out what ports you're listening on?
 
Old 03-16-2005, 09:54 PM   #10
cd1680
Member
 
Registered: Mar 2005
Posts: 40

Original Poster
Rep: Reputation: 15
i tried netstat -anp and then tons of stuff showed up. at least 20
basically i think i narrowed down my problem to just making my ip address static. my router will forward any static ip address's ports. so my question is basically how can i set up a static ip address?
thanks.
 
Old 03-16-2005, 11:03 PM   #11
mcd
Member
 
Registered: Aug 2003
Location: Boulder, CO
Distribution: Slackware, RHEL, CentOS
Posts: 825

Rep: Reputation: 33
ok, if you want a static ip address, follow my instructions above. open a terminal, and here's an example of what you want to type:

[severian@lightstar:~]$ su
Password:
[root@lightstar:/home/severian]$ emacs /etc/rc.d/rc.inet1.conf


and that should open rc.inet1.conf in emacs, which is a text editor. mine looks like this:


# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
DHCP_HOSTNAME[0]=""

# Config information for eth1:
IPADDR[1]="192.168.1.51"
NETMASK[1]=""
USE_DHCP[1]="no"
DHCP_HOSTNAME[1]=""

# Default gateway IP address:
GATEWAY="192.168.1.1"


this is my laptop, so eth0 is my wireless card for when i'm at home, and i use dhcp to obtain an ip address from my router. eth1 is my wired ethernet card for work where i'm assigned a static ip (you should only set one interface, leave the others empty). in both cases the router acts as my gateway, which is why i put 192.168.1.1 as my default gateway. you can save through the menu, or ctl-x ctl-s, close with ctl-x ctl-c. then stop and start this script like this:

[root@lightstar:/home/severian]$ /etc/rc.d/rc.inet1 stop
[root@lightstar:/home/severian]$ /etc/rc.d/rc.inet1 start
/etc/rc.d/rc.inet1: eth0 is '2312 ESSID'
dhcpcd: MAC address = 00:02:2d:58:de:a6
dhcpcd: your IP address = 192.168.1.101

typing ifconfig will verify that things worked properly. you can also type man ifconfig to find out how to set up interfaces manually (you should definitely read this!).



now as for netstat, here's an example when i run netstat on my home mail server. it's running sshd for remote login, sendmail for smtp, and imapd for mail retreival.

mcd@ironmonkey:~$ su
Password:
root@ironmonkey:/home/mcd# netstat -anp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 137/sendmail: accep
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 118/inetd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 121/sshd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 137/sendmail: accep
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 1451/0
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 1501/1
tcp 0 240 192.168.1.105:22 192.168.1.1:32824 ESTABLISHED 1499/sshd: mcd [pri
tcp 0 0 192.168.1.105:143 192.168.1.1:2104 ESTABLISHED 1466/imapd
tcp 0 0 192.168.1.105:22 192.168.1.1:32769 ESTABLISHED 1449/sshd: mcd [pri
udp 0 0 0.0.0.0:68 0.0.0.0:* 81/dhcpcd
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 7 [ ] DGRAM 58 60/syslogd /dev/log
unix 3 [ ] STREAM CONNECTED 8781 1499/sshd: mcd [pri
unix 3 [ ] STREAM CONNECTED 8780 1501/1
unix 2 [ ] DGRAM 8632 1466/imapd
unix 3 [ ] STREAM CONNECTED 8540 1449/sshd: mcd [pri
unix 3 [ ] STREAM CONNECTED 8539 1451/0
unix 2 [ ] DGRAM 205 140/clientmqueue
unix 2 [ ] DGRAM 187 137/sendmail: accep
unix 2 [ ] DGRAM 88 81/dhcpcd
unix 2 [ ] DGRAM 61 63/klogd



ignore the entries at the bottom, they're just local things on your system (and i don't know anything about them). pay attention to anything with LISTEN. you can see that sshd is listening on tcp port 22, so i need to make sure to leave that port open for input (in my firewall) and forward that port on my router to this ip address. imapd is listening on tcp port 143, so same thing for that one. now, i happen to know that the sendmail service listening on 587 is auth, when i don't want. so i left that port blocked. anything from 127.* is your loopback interface (i leave all traffic on lo open, so i left these ports blocked). pay attention to tcp vs. udp - open only the ports you need. remember this doesn't list services that require outbound ports open.

EDIT: i just noticed inetd is listening on 143, not imapd. well inetd will call imapd if it gets a request on that port, it's a superdaemon or something. check out /etc/rc.d/rc.inetd and man inetd if you're curious.

i hope that helps. if you have a service running and you don't know what it is, or if you need it, check the man page. man sshd, for instance. good luck!

Last edited by mcd; 03-16-2005 at 11:10 PM.
 
Old 03-17-2005, 10:46 AM   #12
cd1680
Member
 
Registered: Mar 2005
Posts: 40

Original Poster
Rep: Reputation: 15
thanks for the reply, but i am running fedora 3. there is no file which you specified to edit. i am a newbie and do not know what file to edit. can anyone help? btw is how would i check what ip address my computer is?

Last edited by cd1680; 03-17-2005 at 11:35 AM.
 
Old 03-17-2005, 03:25 PM   #13
mcd
Member
 
Registered: Aug 2003
Location: Boulder, CO
Distribution: Slackware, RHEL, CentOS
Posts: 825

Rep: Reputation: 33
FC uses the system V init instead. i don't know the exact layout, so intead of putting all the init scripts in one directory (etc/rc.d/) there are separate directories for each of the main scripts (/etc/rc.0/ /etc/rc.1/ /etc/rc.M/ and so on). i'dlook for /etc/rc.net, or /etc/rc.M. in fact, just

slocate rc.inet1

should tell you where it is. and if you want to see what your current ip address is:

ifconfig

will show you. i highly, highly, highly recommend reading the man page for ifconfig.

man ifconfig

Last edited by mcd; 03-17-2005 at 03:26 PM.
 
Old 03-27-2005, 07:58 PM   #14
dwj
LQ Newbie
 
Registered: Mar 2005
Posts: 1

Rep: Reputation: 0
location of static interface files in Fedora

In Fedora (& RedHat) the location for network interface files is:

/etc/sysconfig/network-scripts

for device eth0 there will be a file named ifcfg-eth0 where you would put your static settings.
 
  


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
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 08:35 PM
Simple Port Forwarding Firewall - not forwarding MadTurki Linux - Security 14 04-09-2006 01:08 PM
How to set a static IP address? dx0r515t Slackware 12 04-17-2005 02:33 PM
Eth0 set up for Static, obtaining DHCP address?! IndustrialGeek Linux - Networking 2 01-03-2005 01:39 AM
FC2 Overriding static if in favor of dhcp system set for static pkraus109 Linux - Networking 8 09-21-2004 12:13 PM


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