I have an interface already configured for an internal interface, which is static under eth0. My question is, can I create a dynamic outfacing interface under eth1.

The reason I want to so this is because, my ISP doesn't support fixed external IP addresses and I am running a server using DynDns. The problem is, I need to set a rule in iptables to FORWARD traffic to my external IP and I need an interface to specify it to iptables, therefore if I use my current external IP it will change.

My output of ifconfig:

root@helloworld:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0e:7f:a9:10:54  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::20e:7fff:fea9:1054/64 Scope:Link
          RX packets:357 errors:0 dropped:0 overruns:0 frame:0
          TX packets:358 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:37555 (37.5 KB)  TX bytes:43900 (43.9 KB)

lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:36 errors:0 dropped:0 overruns:0 frame:0
          TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3467 (3.4 KB)  TX bytes:3467 (3.4 KB)
  • 1
    Are you using a router to connect to the internet? Usually the router connects to your ISP (and gets an external ip) and you connect to your router by LAN (local area network) with an intern IP Adress - the router usually masquerades your internal IP by using NAT. How do you connect to the internet? – Wolfgang Mar 9 '14 at 10:59

Without catching what you really want to do you could use multiple instances of your interface: See setting up multiple ips in ubuntu

Hope this helps

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.