Saturday, November 4, 2017

Access to local dhcp server via ssh




I constructed dhcp server on centOS6 (which has a ipaddress 192.168.0.0)
to allocate ip address, 192.168.0.5, to other local node.



When i use "service network restart" on client node and type ifconfig, the client node show their allocated ip (192.168.0.5) and subnetmask (255.255.255.0)




However When i try to access dhcp server from client node using ssh (hostname)@192.168.0.5, the terminal just show "ssh: connect to host 192.168.0.0 port 22: Network is unreachable".



what's wrong with my concept? I can't even guess.
Below are my configuration files.



/etc/sysconfig/network-script/ifcfg-eth0 on server



TYPE="Ethernet"
BOOTPROTO=static

NAME="eth0"
UUID=(UUID on server)
ONBOOT="yes"
IPADDR0=192.168.0.0
NETMASK=255.255.255.0
HWADDR=(MAC address on server)


/etc/sysconfig/network-script/ifcfg-eth0 on client




TYPE="Ethernet"
BOOTPROTO=dhcp
NAME="eth0"
UUID=(UUID on client ethernet)
ONBOOT="yes"
HWADDR=(MAC address on client ethernet)


/etc/dhcp/dhcpd.conf




subnet 192.168.0.0 netmask 255.255.255.0 {

host node2 {
hardware ethernet (Mac address on client ethernet);
fixed-address 192.168.0.5;
}

}

Answer




You can't use 192.168.0.0 as the IP address on the router / DHCP server.



With a /24 subnet (netmask 255.255.255.0) the first usable IP address is 192.168.0.1.



For more information as to why see this previous Q&A.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...