Friday, July 23, 2010

how to setup multi ip address on one network card for Linux /MAC MACBOOK

When you test the Cassandra clustering on a Single laptop. It requires several IP addresses to build one cluster. here is the how to setup one Linux and matchbook.

  • Linux.
      setup 127.0.0.5 and 127.0.0.100 to Loopback interface


      androiddemo:/home/demouser# ifconfig lo:5 127.0.0.5 netmask 255.0.0.0 up
      androiddemo:/home/demouser# ping 127.0.0.5
      PING 127.0.0.5 (127.0.0.5) 56(84) bytes of data.
      64 bytes from 127.0.0.5: icmp_seq=1 ttl=64 time=0.040 ms
      64 bytes from 127.0.0.5: icmp_seq=2 ttl=64 time=0.025 ms
      ^C
      --- 127.0.0.5 ping statistics ---
      2 packets transmitted, 2 received, 0% packet loss, time 999ms
      rtt min/avg/max/mdev = 0.025/0.032/0.040/0.009 ms
      androiddemo:/home/demouser# ifconfig lo:100 127.0.0.100 netmask 255.0.0.0 up
      androiddemo:/home/demouser# ping 127.0.0.100
      PING 127.0.0.100 (127.0.0.100) 56(84) bytes of data.
      64 bytes from 127.0.0.100: icmp_seq=1 ttl=64 time=0.031 ms
      ^C

  • Macbook
      setup 127.0.0.2 and 127.0.0.3 to loopback interface

      DemoMacbook-MacBook:~ androidyou$ sudo ifconfig lo0
      lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
          inet 127.0.0.1 netmask 0xff000000
          inet6 ::1 prefixlen 128
          inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
      DemoMacbook-MacBook:~ androidyou$ sudo ifconfig lo0 alias 127.0.0.2
      DemoMacbook-MacBook:~ androidyou$ sudo ifconfig lo0 alias 127.0.0.3
      DemoMacbook-MacBook:~ androidyou$ sudo ifconfig lo0
      lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
          inet 127.0.0.1 netmask 0xff000000
          inet6 ::1 prefixlen 128
          inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
          inet 127.0.0.2 netmask 0xff000000
          inet 127.0.0.3 netmask 0xff000000
      DemoMacbook-MacBook:~ androidyou$ ping 127.0.0.3
      PING 127.0.0.3 (127.0.0.3): 56 data bytes
      64 bytes from 127.0.0.3: icmp_seq=0 ttl=64 time=0.040 ms
      64 bytes from 127.0.0.3: icmp_seq=1 ttl=64 time=0.047 ms

 

Hope it helps

2 comments:

Anonymous said...

I would like to exchange links with your site androidyou.blogspot.com
Is this possible?

gargee said...

Thanks a lot

 
Locations of visitors to this page