Archive for the ‘Life the Universe and Everything’ Category

sipcalc

By Mark Davidson on March 11th, 2010

While setting up some iptables rules the other day to allow connections from a clients IP range to are servers in London. I needed to translate an IP range expressed as a CIDR to real from and to values. I remembered being taught how to do so in college but that was a long time ago now so was looking for an online tool, I couldn’t find any I liked so I checked for a Linux tool. I found one called sipcalc which is really good. Not only can it do what I needed with translating the CIDR notation it can do a few other calculations / conversions as well.

Simple install process under Ubuntu just the usual

sudo apt-get install sipcalc

Once install its ready to go. To convert an IP range expressed in CIDR format you simply do

sipcalc 165.19.104.1/23
-[ipv4 : 165.19.104.1/23] - 0

[CIDR]
Host address            - 165.19.104.1
Host address (decimal)  - 2769512449
Host address (hex)      - A5136801
Network address         - 165.19.104.0
Network mask            - 255.255.254.0
Network mask (bits)     - 23
Network mask (hex)      - FFFFFE00
Broadcast address       - 165.19.105.255
Cisco wildcard          - 0.0.1.255
Addresses in network    - 512
Network range           - 165.19.104.0 - 165.19.105.255
Usable range            - 165.19.104.1 - 165.19.105.254

This is what I needed to do and it worked just fine giving me the network range and more.

Another useful one is to pass in an IP address and subnet mask this once again is a simple way of getting details about the IP range

sipcalc 10.0.1.84 255.255.0.0
-[ipv4 : 10.0.1.84 255.255.255.0] - 0

[CIDR]
Host address            - 10.0.1.84
Host address (decimal)  - 167772500
Host address (hex)      - A000154
Network address         - 10.0.1.0
Network mask            - 255.255.255.0
Network mask (bits)     - 24
Network mask (hex)      - FFFFFF00
Broadcast address       - 10.0.1.255
Cisco wildcard          - 0.0.0.255
Addresses in network    - 256
Network range           - 10.0.1.0 - 10.0.1.255
Usable range            - 10.0.1.1 - 10.0.1.254

The final example which is probably the most useful to people is to pass in an interface as the parameter

sipcalc -i eth0
-[int-ipv4 : eth0] - 0

[CIDR]
Host address            - 109.123.80.196
Host address (decimal)  - 1836798148
Host address (hex)      - 6D7B50C4
Network address         - 109.123.80.0
Network mask            - 255.255.255.0
Network mask (bits)     - 24
Network mask (hex)      - FFFFFF00
Broadcast address       - 109.123.80.255
Cisco wildcard          - 0.0.0.255
Addresses in network    - 256
Network range           - 109.123.80.0 - 109.123.80.255
Usable range            - 109.123.80.1 - 109.123.80.254

iptables Allow UDP traceroute

By Mark Davidson on March 3rd, 2010

If your running iptables most likely your default INPUT policy will be DROP its easy enough to allow most things through and to allow basic pinging to be performed against the server etc.

However traceroute can be a bit more of a problem to allow since if traceroute is being performed using UDP you need to stop the packets going to a wide range of ports from being dropped. Since you really don’t want to open up all the ports it requires most people just leave it and that means you can only traceroute using ICMP.

The best way I have found to get around this is to just set a REJECT on the port range no need for an ACCEPT and everything works fine.

sudo iptables -A INPUT -i eth0 -p udp -m udp --dport 33434:33523 -m state --state NEW -j REJECT --reject-with icmp-port-unreachable

VPS.net 1 Year Bithday – Gives New & Existing Customers a Present

By Mark Davidson on March 3rd, 2010

VPS.net celebrated their 1 year bithday earlier this week and they have given all new and existing customers an upgrade to celebrate this occasion.
Instead of 400Mhz of CPU per node it is now 600Mhz and instead of 256MB of RAM it is now 376MB.
I think this is really good move by them it makes the pricing a lot more attractive to a lot of people and I hope they gain a lot more customers, which will give them more funds to continue improving as they have done over the last year.

They are doing the upgrades as of today at all data centers except UK Cloud – Zone A which will come in a few weeks when the all the VPS’s currently located there get moved to another Cloud. I just rebooted this server which is in Cloud B took just a few minutes and now gained my additional CPU and RAM.

If your not a VPS.net customer yet I suggest you check them out at vps.net. If your going to buy from them please use my affiliate link vps.net and this discount code AV408K which gets you 25% off the first month.