LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-29-2016, 10:54 AM   #1
bluedeep
LQ Newbie
 
Registered: Feb 2016
Posts: 5

Rep: Reputation: Disabled
systemd-networkd: prevent default gateway + add static route to dhcp


I)
I have following configuration:

/etc/systemd/network/enp0s3.network:
----------------------------------------------------
[Match]
Name=enp0s3

[Network]
Description="xxx"
DHCP=yes
Domains=softsystem.pl

[Route]
Gateway=172.29.24.1
Destination=10.0.0.0/8
Metric=1
----------------------------------------------------

/etc/systemd/network/enp0s11u1.network:
----------------------------------------------------
[Match]
Name=enp0s11u1

[Network]
Description="yyy"
DHCP=yes
# Resolver1.OpenDNS.com Resolver2.OpenDNS.com Resolver3.OpenDNS.com Resolver4.OpenDNS.com google google
DNS=208.67.222.222 208.67.220.220 208.67.222.220 208.67.220.222 8.8.8.8 8.8.4.4

[DHCP]
UseDNS=false
----------------------------------------------------


II)
ip route:
----------------------------------------------------
default via 172.29.24.1 dev enp0s3 proto dhcp src 172.29.2.123 metric 1024
default via 192.168.8.1 dev enp0s11u1 proto dhcp src 192.168.8.100 metric 1024
172.29.0.0/19 dev enp0s3 proto kernel scope link src 172.29.2.123
172.29.24.1 dev enp0s3 proto dhcp scope link src 172.29.2.123 metric 1024
192.168.8.0/24 dev enp0s11u1 proto kernel scope link src 192.168.8.100
192.168.8.1 dev enp0s11u1 proto dhcp scope link src 192.168.8.100 metric 1024
----------------------------------------------------


III)

1)
How to tell systemd-networkd not to add:
default via 172.29.24.1 dev enp0s3 proto dhcp src 172.29.2.123 metric 1024
to routing table ?

2)
Why:

[Route]
Gateway=172.29.24.1
Destination=10.0.0.0/8
Metric=1

is not in routing table ?

3)
Is there way to tell systemd-networkd to do something like:
ip route add 10.0.0.0/8 dev enp0s3


???

Please help.
 
Old 03-04-2016, 02:34 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
What's your Linux distribution, Fedora and so on?
 
Old 03-07-2016, 03:55 AM   #3
bluedeep
LQ Newbie
 
Registered: Feb 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
Fedora release 21 (Twenty One)
Linux 4.1.13-100.fc21.x86_64

systemd.x86_64 216-25.fc21

Last edited by bluedeep; 03-07-2016 at 03:57 AM.
 
Old 03-07-2016, 03:05 PM   #4
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
The interface init script is under /etc/sysconfig/network-scripts/ifcfg-ifname. You can set DEFROUTE to no.
 
Old 03-08-2016, 03:46 AM   #5
bluedeep
LQ Newbie
 
Registered: Feb 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
As far as I know /etc/sysconfig/network-scripts/ifcfg-ifname are only for ifup/ifdown scripts and/or NetworkManager but systemd-networkd.service does not use those files because it has its own configuration files.
Am I wrong ?
 
Old 03-09-2016, 02:38 PM   #6
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
Yes, that is for Network Manager. Are you disable network manager?
 
Old 03-10-2016, 03:56 AM   #7
bluedeep
LQ Newbie
 
Registered: Feb 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
Ofcourse I did - I do not want it..
 
Old 03-10-2016, 02:57 PM   #8
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
In /etc/systemd/network/enp0s3.network, create DHCP section to control route that is from DHCP server.

[DHCP]
UseRoutes=false
 
Old 03-11-2016, 03:05 AM   #9
bluedeep
LQ Newbie
 
Registered: Feb 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
It does not work.
(I think this option is for different purpose: https://www.freedesktop.org/software...d.network.html)
 
Old 03-11-2016, 02:45 PM   #10
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
Should be this. It could be a issue.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
systemd enforcing networkd & timesync by the minute husten Linux - Networking 0 09-17-2015 11:45 AM
LXer: How to switch from NetworkManager to systemd-networkd on Linux LXer Syndicated Linux News 0 08-31-2015 07:31 AM
default gateway route is not set by dhcp slockna Slackware 12 07-31-2015 04:20 AM
non-default route to static host through gateway for ppp failover testing jrscandora Linux - Networking 3 04-21-2009 02:20 AM
2 NIC's - one gateway, setup Static route to Host baba_jaga Linux - Newbie 1 04-14-2009 02:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration