Friday, March 28, 2014

loop back in same machine - physically send packet out




http://serverfault.com/questions/127636/force-local-ip-traffic-to-an-external-interface

eth2 10.50.0.1 eth3 10.50.1.1

ping 10.60.0.1
This goes via eth3.
route for 10.60.0.1 added in eth3
10.60.0.1 arp set in eth3
source            dst
============ =============
= 10.50.1.1 =                      = 10.60.0.1  =
============               =============
changed into
source*           dst
============       =============
= 10.60.1.1 =                   =  10.60.0.1  =
============              =============
received by eth2. 10.60.1.1 arp resolved by eth2.
 10.60.1.1 route in eth2.
source               dst
============ =============
= 10.60.1.1 =                     = 10.60.0.1  =
============               =============
changed into
source           dst*
============        =============
= 10.60.1.1 =                    = 10.50.0.1  =
============               =============

10.50.0.1 => eth2 address. so reply  back.


ifconfig p3p1 10.50.0.1/24
ifconfig p3p2 10.50.1.1/24

iptables -t nat -A POSTROUTING -s 10.50.0.1 -d 10.60.1.1 -j SNAT --to-source 10.60.0.1

iptables -t nat -A PREROUTING -d 10.60.0.1 -j DNAT --to-destination 10.50.0.1

iptables -t nat -A POSTROUTING -s 10.50.1.1 -d 10.60.0.1 -j SNAT --to-source 10.60.1.1

iptables -t nat -A PREROUTING -d 10.60.1.1 -j DNAT --to-destination 10.50.1.1

ip route add 10.60.1.1 dev p3p1
arp -i p3p1 -s 10.60.1.1 A0:36:5F:05:E8:2E  //p3p2's mac address

ip route add 10.60.0.1 dev p3p2
arp -i p3p2 -s 10.60.0.1 A0:36:4F:05:E8:2C //p3p1 mac address.


Thursday, March 27, 2014

Fedora + arm guestfish: no operating system was found on this disk error - Solved



I thought of trying ARM based Fedora using emulation platform:

tried this command :
virt-copy-out -a Fedora-XFCE-armhfp-20-Alpha-4-sda.raw  /boot .

got this erorr:
guestfish: no operating system was found on this disk


Thanks libguestfs author , libguestfs which I used is very OLD.
So I tried using another command which he informed about.
guestfish --ro -a Fedora-XFCE-armhfp-20-Alpha-4-sda.raw -m /dev/sda1 tar-out / boot_simple.tar

This worked out. Thanks to rwmjones !

Wednesday, March 26, 2014

NAT




Nice intro on NAT:




Source IP addresses are changed to the exterior IP address of the Nat Host

Source Port numbers are changed to a unique value

transalted session must be saved in a state table.

Return traffic is matched in the state table and destination IP and port numbers are modified accordingly.


- impossible to map the real topology of the network.

- interior hosts are NOT reachable from the internet.


IP masquerading IS NOT a TRUE NAT implementation.(Linux 2.2.x kernels)

Linux 2.4.x kernels uses IPTables which provides NAT. It is TRUE NAT.


http://bio3d.colorado.edu/tor/sadocs/tcpip/nat.html#true%20nat

libguestfs virt-copy-out

how to install libguestfs?

use this :
yum install '*guestf*' -y

Now , you will have binaries like virt-copy-out

Thursday, March 13, 2014

network naming eth0 as em1 , p1p1


I have observed some different naming for ethernet interfaces in the Server.

You can find  the reason here
====================================================================
Systems, particularly servers, with multiple network ports, name the ports ethX in a non-deterministic order, and are therefore not useful for system administrators.
System Administrators can then use BIOS-provided names, which are consistent and not arbitrarily named, for their network ports. This eliminates the confusion that non-deterministic naming brings, and eliminates the use of hard-coded MAC address based port renaming which a) is racy and error-prone, and b) introduces state into an otherwise stateless system.
This change affects most desktop, notebook, and server-class systems.
The em means that the interface is embedded onto the motherboard. Other names apply for add-on cards:p#p# names refer to PCI (and its modern derivatives) expansion cards, where the first number is the slot on the motherboard which they're plugged into, the second number is the port on the card (a card may contain multiple ports) and the third number, if present, is a virtual function number.
====================================================================

Thursday, March 6, 2014

kernel debugging via UML



I was going through UML linux kernel debugging here:
http://www.youtube.com/watch?v=li5EiItG-GU
Very Good effort.

some tips  based on my expereince:

you need to enable following , if you are going to use Fedora20 based rootfs.(available here fs.devloop.org.uk )

CONFIG_BLK_DEV_INITRD=y

CONFIG_CGROUPS=y

CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_XATTR=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
CONFIG_EXT4_DEBUG=y

./linux ubda=$PWD/Fedora20-x86-root_fs  mem=512m  init=/bin/bas


Wednesday, March 5, 2014

IOGEAR switch not switching

IOGEAR switch not working....

just switch mouse and keyboard connected to the IOGEAR switch , it will start working and start switching between CPUs.

Reason here :
http://iogear.custhelp.com/app/answers/detail/a_id/2210/~/gcs632u%3A-unable-to-switch-kvm-ports%3F