Tag Archives: ip

Antinat outgoing ip same as incoming

Problem

The previous post shows you how you can configure the outgoing ip in antinat but if you have multiple ips and you want to use all of them and you want to be able to control which one to be used for certain things that patch doesn't do enough for you.

Solution

Antinat should bind the ougoing connection on the same ip on which it receives the connection from the client.

So if you want to use a different ip just set your configure your socks settings in the browser or proxifier to the ip you want antinat to use.

And here's the patch to let you do that ...

Antinat outgoing ip same as Incomming-1.0 (10.1 KB)

This patch is incompatible with the one on the previous post, you can either have that one or  this one so make sure you apply it on the original antinat source.

Questions or suggestions are welcome as always ...

http://www.google.com/url?sa=t&source=web&ct=res&cd=1&ved=0CAgQFjAA&url=http%3A%2F%2Fantinat.sourceforge.net%2F&ei=WoKjS9DcKczFsgaGwJjMCA&usg=AFQjCNEOlqPAc6T7bkDx0VQpJc2kIBBYHA&sig2=Mdve5s6Ylxdz72SqWJdYfA

Antinat outgoing ip

This post is the first in a series of posts about antinat. The posts will provide solutions for some "problems' with antinat. So here goes the first one ....

Problem

Antinat creates outgoing connection from the primary ip defined on the machine where it's running. There's a config option to make antinat listen on a specific ip but no config option to make it use a specific ip for outgoing connections.

Solution

The attached patch will make antinat use the same ip that it's listening on for outgoing connections. You specify the listening ip with the "interface" config option and now that ip will also be used for outgoing connections.

Antinat outgoing ip-1.0 (3.57 KB)

I assume you already know how to patch ... if not ... just ask in the comments or hire me to patch it for you 🙂

Virtualmin custom dynip

Virtualmin has this nice feature where you can enable dynamic host and virtualhost updates so when your ip changes virtualmin updates the ips in the virtualhosts definitions. Without this feature your sites would not work anymore if your ip changes and you would have to update the ips manually.

The problem with this feature is that it only supports the DynDNS service and not everyone is using this service to update their host when their ip changes.

I'm using my own dynamic dns service and the good news is that this service is using the same protocol as DynDNS so virtualmin needs little change in order to support it.

All I had to do was add a way of specifying the hostname and port of the dynip update server.

Here's the patch for virtualmin ( tested with 3.75 and 3.76 ) :

Virtualmin custom DynIP patch-1.0 (3.74 KB)

Ip alias with dhcp in ubuntu

Problem

You have a machine running ubuntu, NetworkManager gets the ip from a dhcp server and you want to have another ip that never changes on the same interface (for example if you want to also act as a dhcp server for your local network and both the local and uplink are connected on the same interface).

Dhclient seems to support this through an "alias" statement and NetworkManager seems to use dhclient but I just couldn't make it work like this.

Solution

Create a script in /etc/network/if-up.d/ . Name is as  you wish. My choice was "alias" .

  1.  
  2. #!/bin/sh -e
  3. [ "$IFACE" != "lo" ] || exit 0
  4. ip a a 172.16.0.149/22 dev $IFACE
  5.  

Then make sure the script is executable:

  1.  
  2. chmod 755 /etc/network/if-up.d/alias
  3.  

You can replace the ip and mask to fit your needs.
NetworkManager will run this script automatically after it brings the interface up.

This worked for me but in the spirit of usability it would have been nice to have this kind of feature directly into NetworkManager's connection configuration gui.

Do you know any other way of doing this? Please share it in the comments.

Webmin Bulk Add Ip Addresses

Problem

you want to add multiple ips ( aliases ) to a network interface using webmin's Net module. Adding them one by one is a slow process.

Solution

Modify webmin's Net module to allow you to copy/paste ip addresses in a textbox ( one per line ) and then click once and wait for it to do it's job.

Here's the patch for webmin 1.410, I know it's an old version but it should be easy to adapt for newer versions, let me know if you need any help.

Install

Download:  webmin bulk add net aliases-1.410 (5.26 KB)

Apply patch:

  1. cd webmin/net #or wherever webmin is
  2. patch -p1 < webmin-net-bulk-aliases.patch

Usage

Log into webmin as root/admin , go to network configuration, click on  an interface in the interfaces section, click the "Add virtual interface" link and now you should see a text box where you can just insert each ip on a new line. then just click the "Create" button