1

I have two NIC configured on VM's one IP is assign by DHCP on 172.26.43.XX VLAN and 10.10.10.XX is static ip I am installing cloudera beta 5 on these VM, while detecting the host cloudera is returning back with the 172 VLAN IP of all the hosts but i need cloudera to communicate on 10 VLAN

172.26.43.1 (it have gateway and entry on dns server)

route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         172.26.43.1     0.0.0.0         UG    100    0        0 eth0
10.10.10.0      *               255.255.255.0   U     0      0        0 eth1
172.26.43.0     *               255.255.255.0   U     0      0        0 eth0

hosts file on all the host have only entry of the 10.10.10.XX IP corresponding to hostname.

IP of one of the host is 10.10.10.20

output of commands are below

ip route
default via 172.26.43.1 dev eth0  metric 100
10.10.10.0/24 dev eth1  proto kernel  scope link  src 10.10.10.20
172.26.43.0/24 dev eth0  proto kernel  scope link  src 172.26.43.65

ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:a4:dd:27 brd ff:ff:ff:ff:ff:ff
    inet 172.26.43.65/24 brd 172.26.43.255 scope global eth0
    inet6 fe80::a00:27ff:fea4:dd27/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:1d:27:83 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.20/24 brd 10.10.10.255 scope global eth1
    inet6 fe80::a00:27ff:fe1d:2783/64 scope link
       valid_lft forever preferred_lft forever
Vikas Hardia
  • 283
  • 6
  • 15
  • 2
    define primary IP... this doesn't exist as a weel known concept (at leat not one known to me). your host should use as source IP whichever is set on the outpointing interface used to reach its destination. this is of course all based on your routing table. you may be miss-enunciating your needs. please clarify. – alxgomz Jan 24 '14 at 07:17
  • there is no primary interface. There is one bound to your host name and the one which has default route. It may be the same interface. So the question from @alxgomz is absolutely valid: define primary IP. – kofemann Jan 24 '14 at 07:21
  • Apologies for ambiguous terminologies please have a look to updated question. – Vikas Hardia Jan 24 '14 at 09:58

2 Answers2

3

"primary IP" is an alias for "whatever your system uses when it originates traffic to the default route". In the absence of source phrases on that route, that's the first address of the interface used (more or less).

So if your address on eth1 is 10.10.10.11, first find out which address the router on that interface has (either with dhclient or by asking your sysadmin -- let's assume that the answer is 10.10.10.1), then do

    ip route change default via 10.10.10.1 dev eth1

Add src 10.10.10.11 to the end if your system has more than one address on that interface.

NB: you might want to use ip route instead of route. Different syntax, but way more features.

  • not able to run the command getting response RTNETLINK answers: No such file or directory – Vikas Hardia Jan 24 '14 at 10:35
  • It should work. Please add the output of `ip addr` and `ip route` to your question. – Matthias Urlichs Jan 24 '14 at 10:57
  • I have update the question please have a look – Vikas Hardia Jan 24 '14 at 11:26
  • Hmm. `ip route change default via 10.10.10.1 dev eth1` definitely should work, given your interfaces. – Matthias Urlichs Jan 24 '14 at 11:29
  • 1
    getting the same error :( please see the command >>>ip route change default via 10.10.10.1 dev eth1 output >>> RTNETLINK answers: Operation not permitted – Vikas Hardia Jan 24 '14 at 12:30
  • That's not the same at all, previously it was 'no such file or directory'! "Operation not permitted" means you need to do that as root: `sudo ip route change …`. – Matthias Urlichs Jan 24 '14 at 14:40
  • opps my mistake output is RTNETLINK answers: No such file or directory – Vikas Hardia Jan 27 '14 at 07:00
  • That sounds like you don't have a default route in the first place?? You can use `ip route replace default` instead, it'll add a route if none existed before. Either that, or you currently do not have an up&running interface to which 10.10.10.1 is directly connected. – Matthias Urlichs Jan 27 '14 at 14:00
  • after executing suggested command internet on VM is not working. please have a look to this link i had raised an question for the same http://askubuntu.com/questions/408579/internet-is-not-working-on-vm – Vikas Hardia Jan 27 '14 at 14:45
  • If you no longer have internet access after changing the default route, then the box your're now routing your traffic to doesn't receive or forward it. The reasons are out of scope WRT this question. – Matthias Urlichs Jan 28 '14 at 09:08
  • seems things are not working out with the current setup i should revert all the changes and start form scratch and hope for the best to come out. A very big thanks for your help – Vikas Hardia Jan 28 '14 at 12:05
  • Well, you can thank by voting up my answer and/or comments. ;-) – Matthias Urlichs Jan 28 '14 at 14:30
  • Seriously: You're welcome. – Matthias Urlichs Jan 29 '14 at 08:12
1

this cloudera thing probably relies on hostname resolution. check that the hostname of your host points to the IP 10.x.x.x. for instance, on a debian like system you should check that the hostname configured in /etc/hostname maps to the 10.x.x.x IP in /etc/hosts.

alxgomz
  • 1,630
  • 1
  • 11
  • 14
  • my hostname file have entry of 10.X.X.X IP of all the hosts. – Vikas Hardia Jan 27 '14 at 06:59
  • What does the following command returns?: ping -c 1 $(hostname) – alxgomz Jan 27 '14 at 07:31
  • PING cdh4hbm.is.co.in (172.26.43.86) 56(84) bytes of data. 64 bytes from 172.26.43.86: icmp_req=1 ttl=64 time=1.13 ms --- cdh4hbm.is.co.in ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 1.139/1.139/1.139/0.000 ms – Vikas Hardia Jan 27 '14 at 11:43
  • does your /etc/hosts file really contains an entry 10.x.x.x for cdh4hbm.is.co.in? if So check tout /etc/nsswitch.conf – alxgomz Jan 27 '14 at 19:26
  • it is showing following: passwd: compat group: compat shadow: compat hosts: files dns networks: files protocols: db files services: db files ethers: db files rpc: db files netgroup: nis – Vikas Hardia Jan 28 '14 at 05:38
  • please answer my very first question. re-read my original answer. you need your /etc/hosts file to contains the appropriate entry pointing to 10.x.x.x for cdh4hbm.is.co.in. you certainly don't have it given your nsswitch.conf config. if you really don't understand what I am saying paste your /etc/hosts file – alxgomz Jan 28 '14 at 07:03
  • 127.0.0.1 localhost #127.0.1.1 cdh4hdm # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 10.10.10.12 cdh4hdm 10.10.10.13 cdh4hbm 10.10.10.14 cdh4s1 10.10.10.15 cdh4s2 10.10.10.16 cdh4s3 10.10.10.17 cdh4s4 – Vikas Hardia Jan 28 '14 at 07:39
  • seems things are not working out with the current setup i should revert all the changes and start form scratch and hope for the best to come out. A very big thanks for your help – Vikas Hardia Jan 28 '14 at 12:06
  • 1
    there is NO line with : 10.X.X.X cdh4hbm.is.co.in !!! You only have one with cdh4hbm (without the domain). For some reason you hostname in /etc/hostname is probably fqdn. either fix your /etc/hostname to contain non-fqdn name (as per man hostname), or add cdh4hbm.is.co.in in /etc/hosts. That should do the trick – alxgomz Jan 28 '14 at 22:41
  • The name I am providing in host file and hostname are same :( – Vikas Hardia Jan 30 '14 at 04:38