0

I am a beginner and I have the following doubt:

  1. Currently I'm connecting to the Internet via DHCP address assignment. I'm following apache hadoop setup tutuorial from here where they've asked me to assign IPs 192.168.0.x to the master and slave.

What is the significance of the address? How is it updating in the hosts file diff from updating network interfaces file?

Master and slaves already have IPs of the form A.B.C.D and A.B.E.F.

1 Answer 1

3

The "hosts" file in Ubuntu and other operating systems is used to associate host names with IP addresses.

# /etc/hosts (for master AND slave)
192.168.0.1    master
192.168.0.2    slave

what it mean if you on on master server u can ping slave , u don't have to put 192.168.0.2

how does it work enter image description here

by ping slave from master u don't have to remember the ip address of slave just ping slave & /etc/hosts file will resolve the with the ip automatically

u can edit the network configuration /etc/network/interfaces

(Master)

auto eth0
iface eth0 inet static
        address 192.168.0.1  (or any ip u want )
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1 ( Your gateway , Your router ip )

(Slave)

auto eth0
iface eth0 inet static
        address 192.168.0.2 ( or any ip u want )
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1 ( Your gateway , Your router ip )

Now in both edit /etc/hosts file add master slave entries

Now how to find GATEWAY

before doing anything type # route

route 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default       **192.168.0.1**     0.0.0.0         UG    0      0        0 eth0

OR

  route -n

    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
    0.0.0.0      **192.168.0.1**     0.0.0.0         UG    0      0        0 eth0

Hope This Will Help You

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .