how to set a static ip address or do port forwarding?
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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.
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:
# Default gateway IP address:
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:
(change the location if it's in a different place).
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.
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
and enter the root password to change to superuser. then type
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!).
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 ?
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?
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?
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:
[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:
# Config information for eth1:
# Default gateway IP address:
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.
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!
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?
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
should tell you where it is. and if you want to see what your current ip address is:
will show you. i highly, highly, highly recommend reading the man page for ifconfig.