how to find ip address on linux computer

You can see the IP addresses of all your interfaces by doing :

/sbin/ifconfig

If you want to forward external requests to another machine on the lan then you can use nat. For example, using iptables for 2.4 series kernels :

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j DNAT --to 192.168.1.1

The above example would take all input arriving on interface eth1 (-i eth1) of protocol tcp (-p tcp) with a destination port of 80 (--dport 80) and re-direct it to IP address 192.168.1.1 . You can make it more or less specfic if you wish.

No comments: