title: IP is changing when sending UDP packet with spoofed IP in C Ubuntu 12.04
body: <p>I am writing a code in C, Eclipse, Ubuntu 12.04. I am opening a socket and sending UDP packets from spoofed source IP.
  When I run the code in the virtual machine (the same code, Eclipse, Ubuntu version) everything was OK, but now when I try to run it on real Ubuntu machine it doesn't work properly. </p>
  
  <pre><code>bzero(&amp;spoof_addr, sizeof(spoof_addr));
  spoof_addr.sin_family = AF_INET;
  spoof_addr.sin_port = htons(SERVERPORT);
  if (inet_aton("192.168.160.240", &amp;spoof_addr.sin_addr)==0)
  {
      fprintf(stderr, "inet_aton() failed\n");
      exit(1);
  }    
  
  if ((sockfd_spoofed = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
          err("socket");
       bind(sockfd_spoofed,(struct sockaddr*)&amp;spoof_addr,sizeof(spoof_addr));
  
      //Send the packet
      if (sendto(sockfd_spoofed, buf_port, 5, 0, (struct sockaddr*)&amp;dest_addr, sizeof(dest_addr))==-1)
  </code></pre>
  
  <p>The problem is Ubuntu/kernel changes my source IP to real IP of the only interface I have.
  Eclipse runs without any errors or warnings. So I understand, that IP is changing after the packet leaves the Eclipse application.
  I tried to add additional IP like this:
       ifconfig eth0:1 192.168.160.240 netmask 255.255.255.0 up    (this worked in virtual machine) but doesn't affect real PC.</p>