abzaatari
Posts: 1
Joined: Fri Sep 27, 2019 9:22 am

assign static ip

Fri Sep 27, 2019 9:36 am

Hi, I am using raspberry pi3 A+ as repeater and it works fine, how to assign a static IP by mean of MAC address to the smart devices conneced to RP3 A+ as original router has this option?


thanx

RattusRattus
Posts: 70
Joined: Sat Sep 29, 2018 11:27 am

Re: assign static ip

Fri Sep 27, 2019 2:40 pm

OK so I assume from what you have said you are running a dhcp server (ihc-dhcp-server?) to assign the IP address to the 'client' machines that you want to always have the same IP address assigned.

In which case you would edit /etc/dhcpd.conf and add the following lines (iirc there is an example already in the config file)


host <name_of_client> {
hardware ethernet <mac_address_of_cleient>;
fixed-address <ip_address_to_give_client>;
}


Don't forget to ensure that the fixed-addresses that you want to hand out need to be inside a valid subnet but at the same time NOT in the same range given from the lease pool.

I.e.

# Pool
subnet 10.99.0.0 netmask 255.255.255.0 {
range 10.99.0.100 10.99.0.199;
option routers 10.99.0.1;
option broadcast-address 10.99.0.255;
default-lease-time 3600;
max-lease-time 7200;
}

#hosts / client machines
host monolaser {
hardware ethernet 00:14:38:e1:79:84;
fixed-address 10.99.0.11;
}


/Andy

Return to “General discussion”