Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] DHCP server
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
beren43
n00b
n00b


Joined: 19 Dec 2015
Posts: 21

PostPosted: Sat Dec 19, 2015 12:40 pm    Post subject: [Solved] DHCP server Reply with quote

Installed gentoo. Then you must configure the dhcp server.
In /etc/dhcpd.conf

interfaces=«enp0s8»;
authoritative;
default-lease-time 600;
max-lease-time 7200;
subnet 172.18.0.0 netmask 255.255.255.0 {
range 172.18.0.100 172.18.0.160;
option subnet-mask 255.255.255.0;
option broadcast-address 172.18.0.255;
option routers 172.18.0.1; }


But after /etc/init.d/dhcpd start
unknown option interfaces;
unknown option authoritative;
unknown option default-lease-time
unknown option max-lease-time
unknown option subnet
unknown option range
...


Last edited by beren43 on Tue Dec 29, 2015 2:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42592
Location: 56N 3W

PostPosted: Sat Dec 19, 2015 1:00 pm    Post subject: Reply with quote

beren43,

Welcome to Gentoo.

Normally, you only use a dhcp server on your router. You can use Gentoo as a router if you want to but that's unusual in a home setup.

On Gentoo you configure your dhcp server in /etc/dhcp/dhcpd.conf, rather than /etc/dhcpd.conf.
The file should be present and full of useful comments.

Heres the uncommented lines from my /etc/dhcp/dhcpd.conf
Code:
# The next line is fake
option domain-name "gentoo.org";

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

# no service on these subnets
# don't serve the internet
subnet 62.x.y.z netmask 255.255.255.248 {
}
# dmz     
subnet 192.168.10.0 netmask 255.255.255.0 {
}

# wireless
# lease times from 1 to 4 hours
subnet 192.168.54.0 netmask 255.255.255.0 {
        range 192.168.54.220 192.168.54.239;
        default-lease-time 3600;
        max-lease-time 14400;
        option subnet-mask 255.255.255.0;
        option broadcast-address 192.168.54.255;
        option routers 192.168.54.253;
        option interface-mtu 1492;
        }

# lease times from 12 to 24 hours
subnet 192.168.100.0 netmask 255.255.255.0 {
        range 192.168.100.220 192.168.100.239;
        default-lease-time 31200;
        max-lease-time 43200;
        option subnet-mask 255.255.255.0;
        option broadcast-address 192.168.100.255;
        option routers 192.168.100.253;
        option interface-mtu 1492;
        }


I also have an entry (not shown) to support PXE booting from the days when I used to netboot my media player.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
beren43
n00b
n00b


Joined: 19 Dec 2015
Posts: 21

PostPosted: Sat Dec 19, 2015 1:10 pm    Post subject: Reply with quote

I can use Gentoo as a router.
I have two network interfaces (WAN and LAN). If you need to configure static ip.
I add in /etc/conf.d/net
config_enp0s8="172.18.0.1/24"
Correctly ?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42592
Location: 56N 3W

PostPosted: Sat Dec 19, 2015 1:13 pm    Post subject: Reply with quote

beren43,

That's correct.

I have
Code:
config_eth0="192.168.100.20/24 brd 192.168.100.255"
routes_eth0="default via 192.168.100.253"


My interface is eth0 and yours is enp0s8.

-- edit --

My brd 192.168.100.255 is not strictly required.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
beren43
n00b
n00b


Joined: 19 Dec 2015
Posts: 21

PostPosted: Sat Dec 19, 2015 1:22 pm    Post subject: Reply with quote

After config_enp0s8="172.18.0.1/24 broadcast 172.18.0.255"
This interface has no ip
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42592
Location: 56N 3W

PostPosted: Sat Dec 19, 2015 2:07 pm    Post subject: Reply with quote

beren43,

You will need to (re)start net.enp0s8, which, by default, does not exist.

In /etc/init.d/ net.enp0s8 needs to be a symlink to net.lo.
In my case
Code:
ls -l /etc/init.d/net.*
lrwxrwxrwx 1 root root     6 May 14  2013 /etc/init.d/net.eth0 -> net.lo
-rwxr-xr-x 1 root root 17824 Nov  8 16:42 /etc/init.d/net.lo


Now you can do
Code:
/etc/init.d/net.enp0s8 start
That's restart if its already running.

You can also add net.enp0s8 to the default runlevel.
This is covered in the Gentoo Handbook
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
beren43
n00b
n00b


Joined: 19 Dec 2015
Posts: 21

PostPosted: Sat Dec 19, 2015 2:21 pm    Post subject: Reply with quote

cd /etc/init.d
ln -s net.lo net.enp0s8
Failed to create symlink ./net.enp0s8 file exist
Back to top
View user's profile Send private message
beren43
n00b
n00b


Joined: 19 Dec 2015
Posts: 21

PostPosted: Sat Dec 19, 2015 2:49 pm    Post subject: Reply with quote

How to remove

/etc/init.d/net.enp0s8 -> enp0s8 ?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42592
Location: 56N 3W

PostPosted: Sat Dec 19, 2015 4:18 pm    Post subject: Reply with quote

beren43,

Code:
rm /etc/init.d/net.enp0s8

You need to be root.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
beren43
n00b
n00b


Joined: 19 Dec 2015
Posts: 21

PostPosted: Sat Dec 19, 2015 5:10 pm    Post subject: Reply with quote

rm /etc/init.d/net.enp0s8


it is impossible to remove /etc/init.d/net.enp0s8 no such file or directory
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42592
Location: 56N 3W

PostPosted: Sat Dec 19, 2015 5:14 pm    Post subject: Reply with quote

beren43,

If the file does not exist, you can make the symlink correctly.
If it does exist, rm will remove it.

Tab completion is your friend.
Type /et press tab. You get /etc/ for free.
Rinse and repeat as many times as needed. It helps avoid typing errors in file names.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
beren43
n00b
n00b


Joined: 19 Dec 2015
Posts: 21

PostPosted: Sat Dec 19, 2015 6:11 pm    Post subject: Reply with quote

Ok
I need to create the directory /etc/dhcp and there create a file dhcpd.conf ?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42592
Location: 56N 3W

PostPosted: Sat Dec 19, 2015 6:17 pm    Post subject: Reply with quote

beren43,

If you have net-misc/dhcp already installed both the directory and file should already exist.
You only need edit it.
If you really mean net-misc/dhcpcd, whicd in just the client part, it should just work.

What are you trying to do?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
beren43
n00b
n00b


Joined: 19 Dec 2015
Posts: 21

PostPosted: Sat Dec 19, 2015 7:09 pm    Post subject: Reply with quote

Ok.
Configured in /etc/dhcp/dhcpd.conf
Code:
subnet 172.18.0.0 netmask 255.255.255.0 {
        range 172.18.0.100 172.18.0.110;
        default-lease-time 3600;
        max-lease-time 14400;
        option subnet-mask 255.255.255.0;
        option broadcast-address 172.18.0.255;
        option routers 172.18.0.1;
        option interface-mtu 1492;
        }

/etc/init.d/dhcpd start there are no errors
But clients do not receive ip automatically

Code tags added by NeddySeagoon for easy reading.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42592
Location: 56N 3W

PostPosted: Sat Dec 19, 2015 8:37 pm    Post subject: Reply with quote

beren43,

You need the
Code:
authoritative;
statement too.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
beren43
n00b
n00b


Joined: 19 Dec 2015
Posts: 21

PostPosted: Sun Dec 20, 2015 11:08 am    Post subject: Reply with quote

Code:
authoritative;
subnet 172.18.0.0 netmask 255.255.255.0 {
        range 172.18.0.100 172.18.0.110;
        default-lease-time 3600;
        max-lease-time 14400;
        option subnet-mask 255.255.255.0;
        option broadcast-address 172.18.0.255;
        option routers 172.18.0.1;
        option interface-mtu 1492;
        }


Clients do not receive ip automatically
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 42592
Location: 56N 3W

PostPosted: Sun Dec 20, 2015 12:17 pm    Post subject: Reply with quote

beren43,

What is in your dhcpd log in cd /var/log?

What operating system are the clients using?
Are the clients connecting via wired or wireless?

Explain your network topology.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
beren43
n00b
n00b


Joined: 19 Dec 2015
Posts: 21

PostPosted: Mon Dec 21, 2015 5:40 pm    Post subject: Reply with quote

Thanks for the help. DHCP is working. The problem was that I ran /etc/init.d/dhcpd start. But the service dhcpd status service is stopped.
If service dhcpd start and it worked ! So dchcp the server need to run service dhcpd start ?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum