Find the answer to your Linux question:
Results 1 to 4 of 4
Hi All, I have set up OpenVPN for my connection. I'm using this to connect to the internet from different locations using tunnelling. Right now I have a few IP's ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2010
    Location
    Netherlands
    Posts
    2

    Question IPTABLES - OpenVPN and IP from ISP - how to use another IP?


    Hi All,

    I have set up OpenVPN for my connection. I'm using this to connect to the internet from different locations using tunnelling.

    Right now I have a few IP's : on eth0 I have IP from my ISP, on eth0:1 I have my own IP.
    I set up MASQUERADE to eth0 - but in this case when I try to access my restricted resources IP address from ISP is visible.
    What I want is to use my own IP address from eth0:1 - could somebody help me to build good working redirect entry for that? I want to redirect all connections to that IP assigned on eth0:1... - just to access Internet using my IP.

    Thanks in advance

    Mike

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Not sure I understand you 100% but if you have a restricted IP and it is not being routed by the ISP then you cannot use that IP on the internet to connect to. You ned to connect to a routed IP Address from the internet.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  3. #3
    Just Joined!
    Join Date
    Nov 2007
    Posts
    71
    Hi Morcom, i also don't seem to comprehend what you really want but i think you try this
    # iptables -t nat -A POSTROUTING -o eth0:1 -j SNAT \ --to eth0

    OR

    # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

    or

    IPTABLES -t nat -A POSTROUTING -o $EXTIF -s yourLAN/24 -j MASQUERADE

    please read the command carefully because u need to feelout some infor like "yourLAN/24" you can also replease "$EXTIF" with eth0 but not really necessary, however if the command doesnt work then you can change it, am really not sure that this is what you want but that is how i understand it.
    Cheers

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    May 2010
    Location
    Netherlands
    Posts
    2

    Talking

    OK - just to make things more clear:

    command

    # iptables -t nat -A POSTROUTING -s 10.10.0.0/24 -o eth0 -j MASQUERADE

    is working fine. Unfortunately in this case the IP which is visible for all is IP assigned to eth0 - like e.g. 8.8.8.8 - but on that interface I have as well virtual eth0:1 which is using IP like e.g. 15.15.15.15.

    With this entry my stream is visible as coming from 8.8.8.8 - but I want all other servers to see that the packets are coming from 15.15.15.15 instead of 8.8.8.8.

    So this is a problem right now. Second IP is geographically assigned to my country - first is from data centre which is located in France - so some services in my country are not accessible for me when using VPN. Any proposals??? Please...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •