Static IP & Port Forwarding

Rashkae ubuntu at tigershaunt.com
Tue Dec 2 22:42:35 UTC 2008


ALAN CHE wrote:
> I am new to Linux and never use it before.
> I have install Ubuntu 8.10 Desktop Edition and face some problems.
> (a)  I know that Ubuntu can itself auto detect the networking for me, but
> I prefer to handle it manually. I was wondering where & how can I set a
> fixed ip, subnet mask, gateway, DNS and etc.

First, you'll want to uninstall the Network Manager.  There is, to my
knowledge, no easy and simple way to disable it. Open the Synaptic
Package manager, search for package manager, and remove the packages.  A
few other packages (like the gnome Network manager applet) will also be
removed.

Then you can configure the network by opening your System -
Administration menu, and click Network.  The GUI should be easy to
figure out.


> (b)  I also need to know where & how can I do the port forwarding in
> Ubuntu.

You do this with iptables.  This is a command line interface, so
eventually you will probably want to put these commands in a script.

/etc/rc.local is a good script to put stuff like this, as it runs when
the system starts up.  (Note: don't use sudo in this file)

An example of port forwarding:

sudo iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -J DNAT
--to-destination 192.168.0.1

This example assumes that eth1 is your internet facing network adapter.





More information about the ubuntu-users mailing list