0

I'm trying to set one IP for incoming connections and one IP for outgoing connections on my Ubuntu server with the outgoing IP blocked for incoming connections.

Here's a copy of my ifconfig (I'm censoring some IPv6 IPs with *)

eth0      Link encap:Ethernet  HWaddr *  
          inet addr:45.35.100.115  Bcast:45.35.100.255  Mask:255.255.255.0  
          inet6 addr: * Scope:Link  
          inet6 addr: * Scope:Global  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1  
          RX packets:9570 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:8519 errors:0 dropped:0 overruns:0 carrier:0  
          collisions:0 txqueuelen:1000  
          RX bytes:2448510 (2.4 MB)  TX bytes:6822014 (6.8 MB)  

eth0:1    Link encap:Ethernet  HWaddr *  
          inet addr:50.100.12.12  Bcast:0.0.0.0  Mask:255.255.255.0  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1  

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0  
          inet6 addr: ::1/128 Scope:Host  
          UP LOOPBACK RUNNING  MTU:65536  Metric:1  
          RX packets:10479 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:10479 errors:0 dropped:0 overruns:0 carrier:0  
          collisions:0 txqueuelen:1  
          RX bytes:3275913 (3.2 MB)  TX bytes:3275913 (3.2 MB)

Output of IP route list:

default via 45.33.126.1 dev eth0  metric 100  
45.35.100.0/24 dev eth0  proto kernel  scope link  src 45.35.100.115  
50.100.12.0/24 dev eth0  proto kernel  scope link  src 50.100.12.12  

Output of /etc/network/interfaces:

auto eth0  
allow-hotplug eth0  

iface eth0 inet6 auto

iface eth0 inet static  
    address 45.35.100.115/24  
    gateway 45.35.100.1  
    up   ip addr add 50.100.12.12/24 dev eth0 label eth0:1  
    down ip addr del 50.100.12.12/24 dev eth0 label eth0:1

Please let me know how I can set one IP to receive incoming connections and one IP for all outgoing connections. The outgoing IP should not allow any incoming traffic.

  • 1
    If you send a packet out from an IP address, the return packet must be sent to the same IP. This sounds like an XY problem. Can you explain why you think you need to do this? – Mark Riddell Aug 12 '16 at 21:58
  • trying to prevent IP leakage from a site that allows users to force server requests. Anyway around this without using a tunneling service? – user4510974 Aug 12 '16 at 22:05

Your Answer

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

Browse other questions tagged or ask your own question.