Prevent eth0 from adding default route

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite
1












I am looking for a way to prevent eth0 interface from adding a default route to my main routing table on my Linux machine. I have a Debian distribution (Jessie - 8.0) and was looking at the post-up directive in /etc/network/interfaces. My current configuration looks as follows:



ifconfig



eth0 Link encap:Ethernet HWaddr b8:27:eb:4b:f4:9e 
inet addr:172.16.2.82 Bcast:172.16.3.255 Mask:255.255.252.0
inet6 addr: fe80::ba27:ebff:fe4b:f49e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2311 errors:0 dropped:0 overruns:0 frame:0
TX packets:203 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:187402 (183.0 KiB) TX bytes:22251 (21.7 KiB)

ppp0 Link encap:Point-to-Point Protocol
inet addr:10.178.142.185 P-t-P:192.200.1.21 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:36 errors:0 dropped:0 overruns:0 frame:0
TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:2918 (2.8 KiB) TX bytes:3426 (3.3 KiB)


/etc/network/interfaces



auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
post-up /sbin/route del default dev eth0


ip route show table main



default dev ppp0 scope link 
default via 172.16.0.40 dev eth0 metric 202
10.64.64.65 dev ppp1 proto kernel scope link src 10.181.104.9
169.254.0.0/16 dev wlan0 proto kernel scope link src 169.254.23.201 metric 303
169.254.0.0/16 dev wwan0 proto kernel scope link src 169.254.62.145 metric 305
172.16.0.0/22 dev eth0 proto kernel scope link src 172.16.2.160 metric 202
192.168.42.0/24 dev wlan0 proto kernel scope link src 192.168.42.1
192.200.1.21 dev ppp0 proto kernel scope link src 10.179.96.79


Sadly, this approach only works if the interface is brought up using ifup eth0, and not when the cable is physically connected and ip assigned. Even still, this approach doesn't delete the default entry and ifup gives the following error:



 Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/b8:27:eb:4b:f4:9e
Sending on LPF/eth0/b8:27:eb:4b:f4:9e
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPOFFER from 172.16.0.8
DHCPACK from 172.16.0.8
eminstBootdpxeboot.com option - discarded
eminstBootdpxeboot.com option - discarded
bound to 172.16.2.82 -- renewal in 12663 seconds.
SIOCDELRT: No such process
Failed to bring up eth0.


I would like to know a proper way to ensure that the default route is not added through eth0 and not have to bring up eth0 manually using ifup (to leverage post-up) but rather use the one that is already initialized on boot.










share|improve this question























  • I am using Jessie 8.0
    – user3889963
    Oct 11 '17 at 8:15














up vote
2
down vote

favorite
1












I am looking for a way to prevent eth0 interface from adding a default route to my main routing table on my Linux machine. I have a Debian distribution (Jessie - 8.0) and was looking at the post-up directive in /etc/network/interfaces. My current configuration looks as follows:



ifconfig



eth0 Link encap:Ethernet HWaddr b8:27:eb:4b:f4:9e 
inet addr:172.16.2.82 Bcast:172.16.3.255 Mask:255.255.252.0
inet6 addr: fe80::ba27:ebff:fe4b:f49e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2311 errors:0 dropped:0 overruns:0 frame:0
TX packets:203 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:187402 (183.0 KiB) TX bytes:22251 (21.7 KiB)

ppp0 Link encap:Point-to-Point Protocol
inet addr:10.178.142.185 P-t-P:192.200.1.21 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:36 errors:0 dropped:0 overruns:0 frame:0
TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:2918 (2.8 KiB) TX bytes:3426 (3.3 KiB)


/etc/network/interfaces



auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
post-up /sbin/route del default dev eth0


ip route show table main



default dev ppp0 scope link 
default via 172.16.0.40 dev eth0 metric 202
10.64.64.65 dev ppp1 proto kernel scope link src 10.181.104.9
169.254.0.0/16 dev wlan0 proto kernel scope link src 169.254.23.201 metric 303
169.254.0.0/16 dev wwan0 proto kernel scope link src 169.254.62.145 metric 305
172.16.0.0/22 dev eth0 proto kernel scope link src 172.16.2.160 metric 202
192.168.42.0/24 dev wlan0 proto kernel scope link src 192.168.42.1
192.200.1.21 dev ppp0 proto kernel scope link src 10.179.96.79


Sadly, this approach only works if the interface is brought up using ifup eth0, and not when the cable is physically connected and ip assigned. Even still, this approach doesn't delete the default entry and ifup gives the following error:



 Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/b8:27:eb:4b:f4:9e
Sending on LPF/eth0/b8:27:eb:4b:f4:9e
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPOFFER from 172.16.0.8
DHCPACK from 172.16.0.8
eminstBootdpxeboot.com option - discarded
eminstBootdpxeboot.com option - discarded
bound to 172.16.2.82 -- renewal in 12663 seconds.
SIOCDELRT: No such process
Failed to bring up eth0.


I would like to know a proper way to ensure that the default route is not added through eth0 and not have to bring up eth0 manually using ifup (to leverage post-up) but rather use the one that is already initialized on boot.










share|improve this question























  • I am using Jessie 8.0
    – user3889963
    Oct 11 '17 at 8:15












up vote
2
down vote

favorite
1









up vote
2
down vote

favorite
1






1





I am looking for a way to prevent eth0 interface from adding a default route to my main routing table on my Linux machine. I have a Debian distribution (Jessie - 8.0) and was looking at the post-up directive in /etc/network/interfaces. My current configuration looks as follows:



ifconfig



eth0 Link encap:Ethernet HWaddr b8:27:eb:4b:f4:9e 
inet addr:172.16.2.82 Bcast:172.16.3.255 Mask:255.255.252.0
inet6 addr: fe80::ba27:ebff:fe4b:f49e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2311 errors:0 dropped:0 overruns:0 frame:0
TX packets:203 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:187402 (183.0 KiB) TX bytes:22251 (21.7 KiB)

ppp0 Link encap:Point-to-Point Protocol
inet addr:10.178.142.185 P-t-P:192.200.1.21 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:36 errors:0 dropped:0 overruns:0 frame:0
TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:2918 (2.8 KiB) TX bytes:3426 (3.3 KiB)


/etc/network/interfaces



auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
post-up /sbin/route del default dev eth0


ip route show table main



default dev ppp0 scope link 
default via 172.16.0.40 dev eth0 metric 202
10.64.64.65 dev ppp1 proto kernel scope link src 10.181.104.9
169.254.0.0/16 dev wlan0 proto kernel scope link src 169.254.23.201 metric 303
169.254.0.0/16 dev wwan0 proto kernel scope link src 169.254.62.145 metric 305
172.16.0.0/22 dev eth0 proto kernel scope link src 172.16.2.160 metric 202
192.168.42.0/24 dev wlan0 proto kernel scope link src 192.168.42.1
192.200.1.21 dev ppp0 proto kernel scope link src 10.179.96.79


Sadly, this approach only works if the interface is brought up using ifup eth0, and not when the cable is physically connected and ip assigned. Even still, this approach doesn't delete the default entry and ifup gives the following error:



 Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/b8:27:eb:4b:f4:9e
Sending on LPF/eth0/b8:27:eb:4b:f4:9e
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPOFFER from 172.16.0.8
DHCPACK from 172.16.0.8
eminstBootdpxeboot.com option - discarded
eminstBootdpxeboot.com option - discarded
bound to 172.16.2.82 -- renewal in 12663 seconds.
SIOCDELRT: No such process
Failed to bring up eth0.


I would like to know a proper way to ensure that the default route is not added through eth0 and not have to bring up eth0 manually using ifup (to leverage post-up) but rather use the one that is already initialized on boot.










share|improve this question















I am looking for a way to prevent eth0 interface from adding a default route to my main routing table on my Linux machine. I have a Debian distribution (Jessie - 8.0) and was looking at the post-up directive in /etc/network/interfaces. My current configuration looks as follows:



ifconfig



eth0 Link encap:Ethernet HWaddr b8:27:eb:4b:f4:9e 
inet addr:172.16.2.82 Bcast:172.16.3.255 Mask:255.255.252.0
inet6 addr: fe80::ba27:ebff:fe4b:f49e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2311 errors:0 dropped:0 overruns:0 frame:0
TX packets:203 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:187402 (183.0 KiB) TX bytes:22251 (21.7 KiB)

ppp0 Link encap:Point-to-Point Protocol
inet addr:10.178.142.185 P-t-P:192.200.1.21 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:36 errors:0 dropped:0 overruns:0 frame:0
TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:2918 (2.8 KiB) TX bytes:3426 (3.3 KiB)


/etc/network/interfaces



auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
post-up /sbin/route del default dev eth0


ip route show table main



default dev ppp0 scope link 
default via 172.16.0.40 dev eth0 metric 202
10.64.64.65 dev ppp1 proto kernel scope link src 10.181.104.9
169.254.0.0/16 dev wlan0 proto kernel scope link src 169.254.23.201 metric 303
169.254.0.0/16 dev wwan0 proto kernel scope link src 169.254.62.145 metric 305
172.16.0.0/22 dev eth0 proto kernel scope link src 172.16.2.160 metric 202
192.168.42.0/24 dev wlan0 proto kernel scope link src 192.168.42.1
192.200.1.21 dev ppp0 proto kernel scope link src 10.179.96.79


Sadly, this approach only works if the interface is brought up using ifup eth0, and not when the cable is physically connected and ip assigned. Even still, this approach doesn't delete the default entry and ifup gives the following error:



 Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/b8:27:eb:4b:f4:9e
Sending on LPF/eth0/b8:27:eb:4b:f4:9e
Sending on Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11
DHCPREQUEST on eth0 to 255.255.255.255 port 67
DHCPOFFER from 172.16.0.8
DHCPACK from 172.16.0.8
eminstBootdpxeboot.com option - discarded
eminstBootdpxeboot.com option - discarded
bound to 172.16.2.82 -- renewal in 12663 seconds.
SIOCDELRT: No such process
Failed to bring up eth0.


I would like to know a proper way to ensure that the default route is not added through eth0 and not have to bring up eth0 manually using ifup (to leverage post-up) but rather use the one that is already initialized on boot.







debian routing ethernet






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 11 '17 at 8:38









roaima

40.1k547110




40.1k547110










asked Oct 11 '17 at 7:26









user3889963

111




111











  • I am using Jessie 8.0
    – user3889963
    Oct 11 '17 at 8:15
















  • I am using Jessie 8.0
    – user3889963
    Oct 11 '17 at 8:15















I am using Jessie 8.0
– user3889963
Oct 11 '17 at 8:15




I am using Jessie 8.0
– user3889963
Oct 11 '17 at 8:15










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Edit /etc/dhcp/dhclient.conf and remove routers from the request statement so that your DHCP client does not request default route configuration along with its address request.






share|improve this answer




















  • I tried that, but to no avail. Still the default route comes back up in the main routing table.
    – user3889963
    Oct 13 '17 at 3:30










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f397368%2fprevent-eth0-from-adding-default-route%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Edit /etc/dhcp/dhclient.conf and remove routers from the request statement so that your DHCP client does not request default route configuration along with its address request.






share|improve this answer




















  • I tried that, but to no avail. Still the default route comes back up in the main routing table.
    – user3889963
    Oct 13 '17 at 3:30














up vote
0
down vote













Edit /etc/dhcp/dhclient.conf and remove routers from the request statement so that your DHCP client does not request default route configuration along with its address request.






share|improve this answer




















  • I tried that, but to no avail. Still the default route comes back up in the main routing table.
    – user3889963
    Oct 13 '17 at 3:30












up vote
0
down vote










up vote
0
down vote









Edit /etc/dhcp/dhclient.conf and remove routers from the request statement so that your DHCP client does not request default route configuration along with its address request.






share|improve this answer












Edit /etc/dhcp/dhclient.conf and remove routers from the request statement so that your DHCP client does not request default route configuration along with its address request.







share|improve this answer












share|improve this answer



share|improve this answer










answered Oct 11 '17 at 17:01









user4556274

4,98811123




4,98811123











  • I tried that, but to no avail. Still the default route comes back up in the main routing table.
    – user3889963
    Oct 13 '17 at 3:30
















  • I tried that, but to no avail. Still the default route comes back up in the main routing table.
    – user3889963
    Oct 13 '17 at 3:30















I tried that, but to no avail. Still the default route comes back up in the main routing table.
– user3889963
Oct 13 '17 at 3:30




I tried that, but to no avail. Still the default route comes back up in the main routing table.
– user3889963
Oct 13 '17 at 3:30

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f397368%2fprevent-eth0-from-adding-default-route%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)