Static IP & Port Forwarding

Peter Sabaini peter at sabaini.at
Tue Dec 2 19:50:46 UTC 2008


On Tuesday 02 December 2008 06:31:18 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.

The old-school Debian way to do this is the /etc/network/interfaces file; do 
"main interfaces" for details. 

For a static network setup that also handles DNS you could use the resolvconf 
package:

# apt-get install resolvconf

Then, your /etc/network/interfaces file would look something like this 
(replace 'x' with your values of course): 

 -- snip --

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
  # static ip address
  address xxx.xxx.xxx.xxx
  # netmask -- the value below is common, adapt if necessary
  netmask 255.255.255.0
  # ip address of your uplink
  gateway xxx.xxx.xxx.xxx
  # ip address of your nameserver
  dns-nameserver xxx.xxx.xxx.xxx

 -- snip --

> (b)  I also need to know where & how can I do the port forwarding in
> Ubuntu.
> I will appreciate if you can answer me in an easy way and in details
> because I was not very familiar with the Linux commands.
> Thank you very much.

This is usually done with iptables and possibly some frontend. I use shorewall 
as a frontend, but there are other options also.

hth,
peter.


-- 
  Peter Sabaini
  http://sabaini.at/
  





More information about the ubuntu-users mailing list