Cannot use a secondary IP for outgoing trafficNetwork routing issues on LinuxIPv6 works only after ping to...

Are there physical dangers to preparing a prepared piano?

Can an Area of Effect spell cast outside a Prismatic Wall extend inside it?

I preordered a game on my Xbox while on the home screen of my friend's account. Which of us owns the game?

Can I criticise the more senior developers around me for not writing clean code?

What does the integral of a function times a function of a random variable represent, conceptually?

What is the most expensive material in the world that could be used to create Pun-Pun's lute?

Can someone publish a story that happened to you?

How to limit Drive Letters Windows assigns to new removable USB drives

Critique of timeline aesthetic

Re-entry to Germany after vacation using blue card

How can I practically buy stocks?

On The Origin of Dissonant Chords

How much cash can I safely carry into the USA and avoid civil forfeiture?

Contradiction proof for inequality of P and NP?

Checks user level and limit the data before saving it to mongoDB

How exactly does Hawking radiation decrease the mass of black holes?

Why does Mind Blank stop the Feeblemind spell?

Constructions of PRF (Pseudo Random Function)

Can't get 5V 3A DC constant

Coordinate my way to the name of the (video) game

Pre-plastic human skin alternative

Elements that can bond to themselves?

How to not starve gigantic beasts

How did Captain America manage to do this?



Cannot use a secondary IP for outgoing traffic


Network routing issues on LinuxIPv6 works only after ping to routing boxKVM/Libvirt bridged/routed networking not working on newer guest kernelsIP address reuse on macvlan devicesRemote end of IPSec transport is 'permenantly glued' to loopback after some messing around with GRERoute traffic through private IP for only certain hosts - CentOS 6.6How to correctly set up routing on machine with 4 interfaces so that three of interfaces are on the same subnet?IPTables DNAT WAN interface to hosted VM fails but DNAT to WAN IP succeedsWhy do ping to internet don't work?Linux: Bridging two ethernet connections together to allow second host onto first network






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have a server (Ubuntu 18.04) with multiple IP address in the same network device.



This is the ip a return:



1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 06:9b:1c:00:00:2a brd ff:ff:ff:ff:ff:ff
inet 191.XXX.XXX.51/23 brd 191.XXX.XXX.255 scope global dynamic ens3
valid_lft 80087sec preferred_lft 80087sec
inet 179.XXX.XXX.0/32 scope global ens3
valid_lft forever preferred_lft forever
inet 179.XXX.XXX.1/32 scope global ens3
valid_lft forever preferred_lft forever
inet 179.XXX.XXX.2/32 scope global ens3
valid_lft forever preferred_lft forever
inet 179.XXX.XXX.3/32 scope global ens3
valid_lft forever preferred_lft forever
inet6 fe80::XXX:XXX:XXX:2a/64 scope link
valid_lft forever preferred_lft forever


And this is my route -n return:



Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 191.XXX.XXX.1 0.0.0.0 UG 100 0 0 ens3
191.XXX.XXX.0 0.0.0.0 255.255.254.0 U 0 0 0 ens3
191.XXX.XXX.1 0.0.0.0 255.255.255.255 UH 100 0 0 ens3


So I have a main public IP: 191.XXX.XXX.51 and 4 more secondary public IPs: 179.XXX.XXX.0-3



My final goal is to use my secondary IPs for outgoing connections, I think that I can achieve this using routing tables or iptables, but I don't know how.



For example:
If I ping google.com:



user@server:# ping google.com

PING google.com (216.58.202.142) 56(84) bytes of data.
64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=1 ttl=57 time=1.01 ms
64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=2 ttl=57 time=1.05 ms
64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=3 ttl=57 time=0.965 ms
64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=4 ttl=57 time=0.993 ms
^C
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 0.965/1.005/1.055/0.050 ms


Everything works fine, but if I choose another IP to be the source of the ping:



ping -I 179.XXX.XXX.1 google.com


The ping has 100% packet loss.



The same happens with tinyproxy, if I configure to use the secondary IP as outgoing IP the connection just fails.



PS. The secondary IP works if I ping them from outside the server.



So how can I make the secondary IP useful to reach the Internet?









share







New contributor




Gui is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



























    0















    I have a server (Ubuntu 18.04) with multiple IP address in the same network device.



    This is the ip a return:



    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
    valid_lft forever preferred_lft forever
    2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 06:9b:1c:00:00:2a brd ff:ff:ff:ff:ff:ff
    inet 191.XXX.XXX.51/23 brd 191.XXX.XXX.255 scope global dynamic ens3
    valid_lft 80087sec preferred_lft 80087sec
    inet 179.XXX.XXX.0/32 scope global ens3
    valid_lft forever preferred_lft forever
    inet 179.XXX.XXX.1/32 scope global ens3
    valid_lft forever preferred_lft forever
    inet 179.XXX.XXX.2/32 scope global ens3
    valid_lft forever preferred_lft forever
    inet 179.XXX.XXX.3/32 scope global ens3
    valid_lft forever preferred_lft forever
    inet6 fe80::XXX:XXX:XXX:2a/64 scope link
    valid_lft forever preferred_lft forever


    And this is my route -n return:



    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    0.0.0.0 191.XXX.XXX.1 0.0.0.0 UG 100 0 0 ens3
    191.XXX.XXX.0 0.0.0.0 255.255.254.0 U 0 0 0 ens3
    191.XXX.XXX.1 0.0.0.0 255.255.255.255 UH 100 0 0 ens3


    So I have a main public IP: 191.XXX.XXX.51 and 4 more secondary public IPs: 179.XXX.XXX.0-3



    My final goal is to use my secondary IPs for outgoing connections, I think that I can achieve this using routing tables or iptables, but I don't know how.



    For example:
    If I ping google.com:



    user@server:# ping google.com

    PING google.com (216.58.202.142) 56(84) bytes of data.
    64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=1 ttl=57 time=1.01 ms
    64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=2 ttl=57 time=1.05 ms
    64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=3 ttl=57 time=0.965 ms
    64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=4 ttl=57 time=0.993 ms
    ^C
    --- google.com ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3004ms
    rtt min/avg/max/mdev = 0.965/1.005/1.055/0.050 ms


    Everything works fine, but if I choose another IP to be the source of the ping:



    ping -I 179.XXX.XXX.1 google.com


    The ping has 100% packet loss.



    The same happens with tinyproxy, if I configure to use the secondary IP as outgoing IP the connection just fails.



    PS. The secondary IP works if I ping them from outside the server.



    So how can I make the secondary IP useful to reach the Internet?









    share







    New contributor




    Gui is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I have a server (Ubuntu 18.04) with multiple IP address in the same network device.



      This is the ip a return:



      1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
      inet 127.0.0.1/8 scope host lo
      valid_lft forever preferred_lft forever
      inet6 ::1/128 scope host
      valid_lft forever preferred_lft forever
      2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
      link/ether 06:9b:1c:00:00:2a brd ff:ff:ff:ff:ff:ff
      inet 191.XXX.XXX.51/23 brd 191.XXX.XXX.255 scope global dynamic ens3
      valid_lft 80087sec preferred_lft 80087sec
      inet 179.XXX.XXX.0/32 scope global ens3
      valid_lft forever preferred_lft forever
      inet 179.XXX.XXX.1/32 scope global ens3
      valid_lft forever preferred_lft forever
      inet 179.XXX.XXX.2/32 scope global ens3
      valid_lft forever preferred_lft forever
      inet 179.XXX.XXX.3/32 scope global ens3
      valid_lft forever preferred_lft forever
      inet6 fe80::XXX:XXX:XXX:2a/64 scope link
      valid_lft forever preferred_lft forever


      And this is my route -n return:



      Kernel IP routing table
      Destination Gateway Genmask Flags Metric Ref Use Iface
      0.0.0.0 191.XXX.XXX.1 0.0.0.0 UG 100 0 0 ens3
      191.XXX.XXX.0 0.0.0.0 255.255.254.0 U 0 0 0 ens3
      191.XXX.XXX.1 0.0.0.0 255.255.255.255 UH 100 0 0 ens3


      So I have a main public IP: 191.XXX.XXX.51 and 4 more secondary public IPs: 179.XXX.XXX.0-3



      My final goal is to use my secondary IPs for outgoing connections, I think that I can achieve this using routing tables or iptables, but I don't know how.



      For example:
      If I ping google.com:



      user@server:# ping google.com

      PING google.com (216.58.202.142) 56(84) bytes of data.
      64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=1 ttl=57 time=1.01 ms
      64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=2 ttl=57 time=1.05 ms
      64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=3 ttl=57 time=0.965 ms
      64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=4 ttl=57 time=0.993 ms
      ^C
      --- google.com ping statistics ---
      4 packets transmitted, 4 received, 0% packet loss, time 3004ms
      rtt min/avg/max/mdev = 0.965/1.005/1.055/0.050 ms


      Everything works fine, but if I choose another IP to be the source of the ping:



      ping -I 179.XXX.XXX.1 google.com


      The ping has 100% packet loss.



      The same happens with tinyproxy, if I configure to use the secondary IP as outgoing IP the connection just fails.



      PS. The secondary IP works if I ping them from outside the server.



      So how can I make the secondary IP useful to reach the Internet?









      share







      New contributor




      Gui is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I have a server (Ubuntu 18.04) with multiple IP address in the same network device.



      This is the ip a return:



      1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
      inet 127.0.0.1/8 scope host lo
      valid_lft forever preferred_lft forever
      inet6 ::1/128 scope host
      valid_lft forever preferred_lft forever
      2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
      link/ether 06:9b:1c:00:00:2a brd ff:ff:ff:ff:ff:ff
      inet 191.XXX.XXX.51/23 brd 191.XXX.XXX.255 scope global dynamic ens3
      valid_lft 80087sec preferred_lft 80087sec
      inet 179.XXX.XXX.0/32 scope global ens3
      valid_lft forever preferred_lft forever
      inet 179.XXX.XXX.1/32 scope global ens3
      valid_lft forever preferred_lft forever
      inet 179.XXX.XXX.2/32 scope global ens3
      valid_lft forever preferred_lft forever
      inet 179.XXX.XXX.3/32 scope global ens3
      valid_lft forever preferred_lft forever
      inet6 fe80::XXX:XXX:XXX:2a/64 scope link
      valid_lft forever preferred_lft forever


      And this is my route -n return:



      Kernel IP routing table
      Destination Gateway Genmask Flags Metric Ref Use Iface
      0.0.0.0 191.XXX.XXX.1 0.0.0.0 UG 100 0 0 ens3
      191.XXX.XXX.0 0.0.0.0 255.255.254.0 U 0 0 0 ens3
      191.XXX.XXX.1 0.0.0.0 255.255.255.255 UH 100 0 0 ens3


      So I have a main public IP: 191.XXX.XXX.51 and 4 more secondary public IPs: 179.XXX.XXX.0-3



      My final goal is to use my secondary IPs for outgoing connections, I think that I can achieve this using routing tables or iptables, but I don't know how.



      For example:
      If I ping google.com:



      user@server:# ping google.com

      PING google.com (216.58.202.142) 56(84) bytes of data.
      64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=1 ttl=57 time=1.01 ms
      64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=2 ttl=57 time=1.05 ms
      64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=3 ttl=57 time=0.965 ms
      64 bytes from gru06s29-in-f142.1e100.net (216.58.202.142): icmp_seq=4 ttl=57 time=0.993 ms
      ^C
      --- google.com ping statistics ---
      4 packets transmitted, 4 received, 0% packet loss, time 3004ms
      rtt min/avg/max/mdev = 0.965/1.005/1.055/0.050 ms


      Everything works fine, but if I choose another IP to be the source of the ping:



      ping -I 179.XXX.XXX.1 google.com


      The ping has 100% packet loss.



      The same happens with tinyproxy, if I configure to use the secondary IP as outgoing IP the connection just fails.



      PS. The secondary IP works if I ping them from outside the server.



      So how can I make the secondary IP useful to reach the Internet?







      linux networking iptables proxy route





      share







      New contributor




      Gui is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Gui is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Gui is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 8 mins ago









      GuiGui

      1012




      1012




      New contributor




      Gui is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Gui is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Gui is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "2"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Gui is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f964812%2fcannot-use-a-secondary-ip-for-outgoing-traffic%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Gui is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Gui is a new contributor. Be nice, and check out our Code of Conduct.













          Gui is a new contributor. Be nice, and check out our Code of Conduct.












          Gui is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f964812%2fcannot-use-a-secondary-ip-for-outgoing-traffic%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

          Українські прізвища Зміст Історичні відомості |...

          Список ссавців Італії Природоохоронні статуси | Список |...