Prevent eth0 from adding default routeForward port 22 out a particular interfaceCan I prevent a default route...

When encrypting twice with two separate keys, can a single key decrypt both steps?

Should students have access to past exams or an exam bank?

Embedded C - Most elegant way to insert a delay

Can machine learning learn a function like finding maximum from a list?

Solve equation using Mathematica

How to prevent a single-element caster from being useless against immune foes?

"Valet parking " or "parking valet"

Why tantalum for the Hayabusa bullets?

Move arrows along a contour

How did astronauts using rovers tell direction without compasses on the Moon?

What is this kind of symbol meant to be?

What is the highest achievable score in Catan

"DDoouubbllee ssppeeaakk!!"

Reading electrical clamp tester higher voltage/amp 400A

How to have poached eggs in "sphere form"?

How to foreshadow to avoid a 'deus ex machina'-construction

How to choose using Collection<Id> rather than Collection<String>, or the opposite?

My employer is refusing to give me the pay that was advertised after an internal job move

How can Paypal know my card is being used in another account?

What would the United Kingdom's "optimal" Brexit deal look like?

Is it possible for a particle to decay via gravity?

Should I put my name first, or last in the team members list

Antonym of "Megalomania"

What are these bugs on my milkweed?



Prevent eth0 from adding default route


Forward port 22 out a particular interfaceCan I prevent a default route being added when bringing up an interface?Translating this `ip` command to `route` command in `post-up` hookHow to set a routing table that prefers wlan dhcp interface as default route?OpenBSD with only a /32 repeatedly deletes its static route to the worldCan OpenVPN create the default route if it doesn't exist?Routing packets from one interface to anotherIs it possible to have multiple default gateways for outbound connections?How to route traffic from a specific user through a VPN on LinuxMutiple default routes






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







2















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

















bumped to the homepage by Community 18 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















  • I am using Jessie 8.0

    – user3889963
    Oct 11 '17 at 8:15


















2















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

















bumped to the homepage by Community 18 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















  • I am using Jessie 8.0

    – user3889963
    Oct 11 '17 at 8:15














2












2








2


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

48.4k7 gold badges63 silver badges131 bronze badges




48.4k7 gold badges63 silver badges131 bronze badges










asked Oct 11 '17 at 7:26









user3889963user3889963

111 bronze badge




111 bronze badge






bumped to the homepage by Community 18 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.









bumped to the homepage by Community 18 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 18 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • 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


















0














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',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
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















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














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
















0














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














0












0








0







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









user4556274user4556274

5,9261 gold badge15 silver badges26 bronze badges




5,9261 gold badge15 silver badges26 bronze badges
















  • 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




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




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















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...