<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Java Tuning &#187; network</title>
	<atom:link href="http://www.javatuning.com/category/network/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javatuning.com</link>
	<description>Software Development, Java, and some more.</description>
	<lastBuildDate>Tue, 29 Nov 2011 13:26:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>My attempts with IP Spoofing – Revisited</title>
		<link>http://www.javatuning.com/my-attempts-with-ip-spoofing-revisited/</link>
		<comments>http://www.javatuning.com/my-attempts-with-ip-spoofing-revisited/#comments</comments>
		<pubDate>Wed, 22 Sep 2010 15:51:13 +0000</pubDate>
		<dc:creator>Gili Nachum</dc:creator>
				<category><![CDATA[network]]></category>
		<category><![CDATA[IP spoofing]]></category>
		<category><![CDATA[ISP]]></category>
		<category><![CDATA[NAT]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[wireshark]]></category>

		<guid isPermaLink="false">http://www.javatuning.com/?p=269</guid>
		<description><![CDATA[One upon a time (Jan 2009) I&#8217;ve written this post, basically saying that you&#8217;re not likely to be able to spoof IP address over the Internet. Turns out I was dead wrong! It happened so the very experienced Mr Filipe, from Brazil, came across the post and left me a comment saying that Spoofing over&#8230;]]></description>
			<content:encoded><![CDATA[<p>One upon a time (Jan 2009) I&#8217;ve written <a href="http://www.javatuning.com/ip-spoofing-%E2%80%93-only-in-a-lan/">this post</a>, basically saying that you&#8217;re not likely to be able to spoof IP address over the Internet.<br />
Turns out I was dead wrong!</p>
<p>It happened so the very experienced Mr Filipe, from Brazil, came across the post and left me a comment saying that Spoofing over the internet is quiet possible.<br />
I replied surprised, and after a number of comments ping-pongs, we started chatting online, and Felipe had agreed to give me a live spoofing demo:<br />
On my end, I&#8217;ve configured my home router to forward TCP/UDP packets to my desktop, where I ran a wireshark network capture to monitor any incoming packets.<br />
Then Felipe sent a burst of packets from random IP source addresses. Proving me that IP spoofing over the Internet is a reality indeed.</p>
<p>(<em>What do you think? Isn&#8217;t this kind of stuff is what makes the Internet  so amazingly wonderful? two people from two different parts of the world, united by  joint interest and kindness <img src='http://www.javatuning.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em>)</p>
<p><a href="http://www.javatuning.com/wp-content/uploads/2010/09/mask.gif"><img class="size-full wp-image-270 alignright" title="mask" src="http://www.javatuning.com/wp-content/uploads/2010/09/mask.gif" alt="" width="250" height="250" /></a>So,<strong> Thank you Filipe!</strong></p>
<p>A few notes on why spoofing might *not* work:</p>
<ol>
<li>According to Filipe, the recipient&#8217;s ISP is much more likely to block the spoofed packet, than the sender&#8217;s ISP. For example if the recipient&#8217;s ISP see a <a href="http://www.countryipblocks.net/bogons/">bogon </a>source IP.<br />
That&#8217;s a bit counter-intuitive, because, assuming the ISPs really do care about preventing spoofing, it&#8217;s a very easy job for the sender&#8217;s ISP to tell if the packet&#8217;s source IP is one of the IPs that it handed out to customers, or moreover, to the particular customer (sender).</li>
<li>If you are behind a NAT device, then any source address you are planning to use (be it spoofed or real) will be overwritten by the NAT anyway, so make sure you are on a real public IP.</li>
<li>No reason to get excited. TCP spoofing is very limited as you won&#8217;t make it across the TCP handshake, because the recipients will send their ACK,SYN response to the spoofed IP, which you probably don&#8217;t have much control over.<br />
In a LAN things are a bit different, if you can manipulate the recipient&#8217;s ARP table to think that the spoofed IP MAC address is yours. I haven&#8217;t dag deep.</li>
</ol>
<p><em>Feel free to comment.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.javatuning.com/my-attempts-with-ip-spoofing-revisited/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>NAT in VMWare vSphere/ESX – In a nut shell</title>
		<link>http://www.javatuning.com/nat-in-vmware-vsphereesx-in-a-nut-shell/</link>
		<comments>http://www.javatuning.com/nat-in-vmware-vsphereesx-in-a-nut-shell/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 19:00:40 +0000</pubDate>
		<dc:creator>Gili Nachum</dc:creator>
				<category><![CDATA[network]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[appliance]]></category>
		<category><![CDATA[NAT]]></category>
		<category><![CDATA[operating system]]></category>
		<category><![CDATA[router]]></category>

		<guid isPermaLink="false">http://www.javatuning.com/?p=219</guid>
		<description><![CDATA[This post is about NATing an ESX VM, but first, why do I need NAT: The SIP protocol is not NAT oblivious. To traverse NAT our application has to replace the DNS in the SIP message contact header to the external FQDN that the message receiver will be sending responses to (A NAT with static&#8230;]]></description>
			<content:encoded><![CDATA[<p>This post is about NATing an ESX VM, but first, why do I need NAT:</p>
<p>The SIP protocol is not NAT oblivious. To traverse NAT our application has to replace the DNS in the SIP message contact header to the external FQDN that the message receiver will be sending responses to (A NAT with static routing configured).<br />
Therefore I needed to test our software in a NAT topology.</p>
<p>In the past, when we used VMWare player/workstation, it had a build-in NAT network. But, unfortunately, <strong>the ESX hypervisor does not provide a NATed network option.</strong><br />
Seeking alternatives at <a href="http://www.vmware.com/appliances/">VMWare&#8217;s appliance marketplace</a>, I found and downloaded the Vyatta&#8217;s community edition (VC5) router appliance (also downladble from <a href="http://sourceforge.net/projects/vyatta/" class="broken_link">sourceforge</a>), <a href="http://www.vyatta.org/getting-started/vyatta-editions">and comes under the GPL license</a>.<br />
After 3-4 hours &#8211; guided by the official <a href="http://www.vyatta.com/downloads/documentation/VC5.0.2/Vyatta_QuickStart_VC5_v03.pdf" class="broken_link">quick start guide</a> -  I had a working NAT configuration in the ESX. Hurray!<br />
Overall, not a hard <em>nut</em> to crack <img src='http://www.javatuning.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> , though I wish VMWare will wise up and just add an build-in NAT option to vSphere.</p>
<p>Left to do:<br />
Obtain some static IPs, so the config won&#8217;t break each time the vm reboots and the DHCP lease expires.<br />
Tip #1:<br />
If you want want to access your NATed VM by RDP/VNC, without setting up extra NAT routing rules, consider adding the VM an additional un-NATed NIC, but when doing so, make sure that the OS routing tables are set to route through the NIC that is NATed.<br />
Tip #2:<br />
This short <a href="http://kneew.com/node/32">vyatta user installation report</a> also helped me a bit.</p>
<p>Here&#8217;s the complete configuration script I ended up feeding to the appliance console (network topology is similar to the one presented in the <a href="http://www.vyatta.com/downloads/documentation/VC5.0.2/Vyatta_QuickStart_VC5_v03.pdf" class="broken_link">Vyatta&#8217;s getting stated guide</a>):<br />
Where:<br />
1.2.3.4 is your department&#8217;s DNS server<br />
192.168.1.199 is the VMs NATed private IP address (provided by the DHCP).<br />
The script contains a NAT forward rule for VNC (port 5900)</p>
<pre><code>
configure
set system host-name vyatta-nat
set interfaces ethernet eth0 address dhcp
set service ssh
set service https
commit;
save;
# restart the appliance to switch from console remote desktop to SSH:

#login with user and password
configure
show interfaces

set interfaces ethernet eth1 address 192.168.1.254/24

commit;

delete service dhcp-server
set service dhcp-server shared-network-name ETH1_POOL subnet 192.168.1.0/24 start 192.168.1.100 stop 192.168.1.199
set service dhcp-server shared-network-name ETH1_POOL subnet 192.168.1.0/24 default-router 192.168.1.254
set service dhcp-server shared-network-name ETH1_POOL subnet 192.168.1.0/24 dns-server 1.2.3.4
commit;
show service dhcp-server

set service nat rule 1 source address 192.168.1.0/24
set service nat rule 1 outbound-interface eth0
set service nat rule 1 type masquerade
commit;
show service nat
save;
exit
show nat rules
configure
set service nat rule 20 type destination
set service nat rule 20 inbound-interface eth0
# use a negative fake address to so that all incoming communication will be nated
#set service nat rule 20 destination address !192.168.50.0
#Forward traffic to address 192.168.1.199
set service nat rule 20 inside-address address 192.168.1.199
set service nat rule 20 protocol tcp
set service nat rule 20 destination port 5900
commit;
save;
exit
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.javatuning.com/nat-in-vmware-vsphereesx-in-a-nut-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My attempts with IP Spoofing</title>
		<link>http://www.javatuning.com/ip-spoofing-%e2%80%93-only-in-a-lan/</link>
		<comments>http://www.javatuning.com/ip-spoofing-%e2%80%93-only-in-a-lan/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 21:47:52 +0000</pubDate>
		<dc:creator>Gili Nachum</dc:creator>
				<category><![CDATA[network]]></category>
		<category><![CDATA[IP spoofing]]></category>
		<category><![CDATA[NAT]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://www.javatuning.com/?p=58</guid>
		<description><![CDATA[Why did I wanted to spoof source IP addresses? and why did I failed? Here&#8217;s the story before you: &#8212;&#8212;&#8212;&#8212; UPDATE Sep/2010: Dear Filipe (see comments below) had proven to me that spoofing over the internet is indeed possible, read all about it on the continuation post: My attempts with IP Spoofing – Revisited. Now&#8230;]]></description>
			<content:encoded><![CDATA[<p>Why did I wanted to spoof source IP addresses? and why did I<span style="text-decoration: line-through;"> failed</span>? Here&#8217;s the story before you:</p>
<p>&#8212;&#8212;&#8212;&#8212;<br />
UPDATE Sep/2010: Dear Filipe (see comments below) had proven to me that spoofing over the internet is indeed possible, read all about it on the <a href="http://www.javatuning.com/my-attempts-with-ip-spoofing-revisited/" target="_blank">continuation post: My attempts with IP Spoofing – Revisited</a>. Now back to the original story:<br />
&#8212;&#8212;&#8212;&#8212;</p>
<p>When customers install <a href="/about">our product</a>, they often forget to setup firewall rules to accept incoming connections from public IM (instant messaging) providers. Without the firewall rules in place the product does not function properly, of course, and the customer rushes to open a support trouble ticket. Troubleshooting to pinpoint the problem to a missing firewall rule isn&#8217;t trivial. When we try to validate whether the customer defined the required firewall rule, we need the external entity (that we have no control on) to open a connection to the customer&#8217;s IP, but the external entity will only do so following the successful completion of a handshake sequence that must be initiated by the customer (consider for example: <a href="http://xmpp.org/extensions/xep-0220.html">XMPP Dial-Back mechanism</a>), since this handshake by itself is prone to failures, you can see how reproducing the problem is a combursum process.</p>
<p><!--[endif]--></p>
<p class="MsoNormal">I started looking for a simple, independent, and reliable, troubleshooting procedure that would be able to give a clear-cut answer to whether or not the customer defined the firewall correctly.<br />
Here&#8217;s what I&#8217;ve concocted:</p>
<ol>
<li>Assume that the customer IP is <strong>1.1.1.1</strong> and they were suppose to configure their firewall to allow incoming connections from <strong>2.2.2.2</strong>.</li>
<li>I&#8217;ll send a single TCP SYN packet (the 1<sup>st</sup> of the standard three messages TCP handshake) from my computer (say it&#8217;s IP is <strong>9.9.9.9</strong>), but I&#8217;ll spoof the IP datagram&#8217;s source address field to be <strong>2.2.2.2</strong> instead of what normally should have been my actual machine address (<strong>9.9.9.9</strong>).</li>
<li>I&#8217;ll ask the customer to run a network sniffer on the IM Gateway machine. Waiting for the single packet to arrive at the destination socket.</li>
<li>If the sniffer had recorded the incoming IP message, then it means that the firewall is setup correctly and the problem is else where.<br />
But, If the sniffer didn&#8217;t record any incoming SYN packet, then we shell blame the firewall guys.</li>
</ol>
<p>Pretty simple, eh? Now, in order to spoof the TCP SYN packet I needed a something that could generate and send raw IP packets, since you can&#8217;t just fiddle with the source IP address if you choose to ride on the good&#8217;ol TCP/IP stack. I found this <a href="/wp-content/uploads/2009/01/raw.perl">IP spoofing perl script</a> on the net, and it does the job.</p>
<div id="attachment_103" class="wp-caption alignnone" style="width: 310px"><img class="size-full wp-image-103" title="300px-internet_map_1024" src="http://www.javatuning.com/wp-content/uploads/2009/01/300px-internet_map_1024.jpg" alt="Visualization of the various routes through a portion of the Internet. Took it from Wikipedia." width="300" height="300" /><p class="wp-caption-text">Visualization of the various routes through a portion of the Internet. Took it from Wikipedia.</p></div>
<p>I did my first test on the office LAN, I sent a message from machine (IP <strong>9.9.9.9</strong>) to to machine <strong>1.1.1.1</strong> claiming the message source was <strong>2.2.2.2</strong>, it worked! Machine <strong>1.1.1.1</strong> registered an incoming packet from <strong>2.2.2.2</strong>.<br />
It seems that the office router went along with the scam, perhaps it thought that the machine switched IP it IP, or the DHCP server went crazy, or that it&#8217;s ARP cache is just stall.</p>
<p>In the next test I tried sending the packet <strong>over the Internet</strong>, I tried sending a packet to my home computer from the office, with a source IP of some foreign entity, to my dismay, it never got to my home computer. Other IP variations didn&#8217;t work either.<br />
My guess is that some router along the way noticed that it&#8217;s getting a packet with a source IP address that the part of the network it is looking can&#8217;t can&#8217;t possibly generate (imagine <a href="http://en.wikipedia.org/wiki/CIDR">CIDR</a> based ACLs), and that caused it to immediately drop the packet. This failure caused me to give up on the whole spoofing troubleshooting procedure idea.</p>
<p>Some thoughs about what I&#8217;ve seen:</p>
<ol>
<li>Evidently, It&#8217;s quite trivial to spoofe IP addresses on a LAN.</li>
<li>Spoofing  IP addresses over the Internet doesn&#8217;t seem to be trivial.</li>
<li>A side note: If the customer has a reverese proxy, or any form of entity that delegates TCP handshakes, deployed before the actual IM Gateway machine, then the procedure is not applicable, as the first TCP SYN message will never reach the IM Gateway machine.</li>
<li>I would assume that the closer you inject the packet into the Internet backbone blood stream, the better the chances of not getting a rejection of the spoofed packet. The backbone routers communicate with many difference parts of the network, and might not have rational of where certain packates should be coming from or not.<br />
IP Packets tend to travel in different routes, making it harder to judge what IP <a href="http://en.wikipedia.org/wiki/CIDR">CIDR</a> is ligit from each fellow router.</li>
<li>I&#8217;m guessing that the biggest problem for spoofing is the first or the second router (the ISP&#8217;s), since the ISP knows exactly what is your assinged address. Thereby knowning that the packet is spoofed.</li>
<li>If any one knows a better method of spoofing source IP, please step forward and share your secret <img src='http://www.javatuning.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.javatuning.com/ip-spoofing-%e2%80%93-only-in-a-lan/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

