Ubuntu /etc/hosts addresses in the form *.*.*.*
Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
Let's say a website does not have a domain name like www.google.com
and the only way to connect to it is to use an IP address like 216.58.212.68
. If I add an entry in /etc/hosts
that looks likes 0.0.0.0 216.58.212.68
, will it block connections to that website? Would a web browser be blocked from visiting it too?
Additionally, would this also apply to local addresses like 192.168.0.1
?
ubuntu hosts
add a comment |Â
up vote
5
down vote
favorite
Let's say a website does not have a domain name like www.google.com
and the only way to connect to it is to use an IP address like 216.58.212.68
. If I add an entry in /etc/hosts
that looks likes 0.0.0.0 216.58.212.68
, will it block connections to that website? Would a web browser be blocked from visiting it too?
Additionally, would this also apply to local addresses like 192.168.0.1
?
ubuntu hosts
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
Let's say a website does not have a domain name like www.google.com
and the only way to connect to it is to use an IP address like 216.58.212.68
. If I add an entry in /etc/hosts
that looks likes 0.0.0.0 216.58.212.68
, will it block connections to that website? Would a web browser be blocked from visiting it too?
Additionally, would this also apply to local addresses like 192.168.0.1
?
ubuntu hosts
Let's say a website does not have a domain name like www.google.com
and the only way to connect to it is to use an IP address like 216.58.212.68
. If I add an entry in /etc/hosts
that looks likes 0.0.0.0 216.58.212.68
, will it block connections to that website? Would a web browser be blocked from visiting it too?
Additionally, would this also apply to local addresses like 192.168.0.1
?
ubuntu hosts
edited Aug 12 at 23:31


isanae
13716
13716
asked Aug 12 at 14:04
Bjorn
573
573
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
14
down vote
accepted
No. The hosts file doesn't affect any routing. It only affects name lookups. Since 216.58.212.68
is an IP address, the system won't look it up in the hosts table.
Read here for more info on the hosts file: http://manpages.ubuntu.com/manpages/trusty/man5/hosts.5.html
If you want to block connections to an IP address from your system, there are a couple of ways to do that, like:
Blackhole traffic using the
route
command:route add 216.58.212.68 gw 127.0.0.1 lo
Reject traffic using the
route
command:route add -host 216.58.212.68 reject
Null route using the
ip
command:ip route add blackhole 216.58.212.68/32
Now, if you want to block traffic to a system by name, you can add a fake entry to your hosts file pointing that name to the loopback address:
127.0.0.1 badactor.evil.com
Then any traffic trying to get to that host from your system will be faked out – as long as your system is set to use the hosts file lookup prior to DNS. Any specifically DNS based lookups will still work, although you could use a DNSMASQ server like a Pi Hole to block even DNS lookups.
Make sure you read the man pages for the route
and ip
commands, so you'll understand how to make these commands persistent across reboots if you need them to be.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
14
down vote
accepted
No. The hosts file doesn't affect any routing. It only affects name lookups. Since 216.58.212.68
is an IP address, the system won't look it up in the hosts table.
Read here for more info on the hosts file: http://manpages.ubuntu.com/manpages/trusty/man5/hosts.5.html
If you want to block connections to an IP address from your system, there are a couple of ways to do that, like:
Blackhole traffic using the
route
command:route add 216.58.212.68 gw 127.0.0.1 lo
Reject traffic using the
route
command:route add -host 216.58.212.68 reject
Null route using the
ip
command:ip route add blackhole 216.58.212.68/32
Now, if you want to block traffic to a system by name, you can add a fake entry to your hosts file pointing that name to the loopback address:
127.0.0.1 badactor.evil.com
Then any traffic trying to get to that host from your system will be faked out – as long as your system is set to use the hosts file lookup prior to DNS. Any specifically DNS based lookups will still work, although you could use a DNSMASQ server like a Pi Hole to block even DNS lookups.
Make sure you read the man pages for the route
and ip
commands, so you'll understand how to make these commands persistent across reboots if you need them to be.
add a comment |Â
up vote
14
down vote
accepted
No. The hosts file doesn't affect any routing. It only affects name lookups. Since 216.58.212.68
is an IP address, the system won't look it up in the hosts table.
Read here for more info on the hosts file: http://manpages.ubuntu.com/manpages/trusty/man5/hosts.5.html
If you want to block connections to an IP address from your system, there are a couple of ways to do that, like:
Blackhole traffic using the
route
command:route add 216.58.212.68 gw 127.0.0.1 lo
Reject traffic using the
route
command:route add -host 216.58.212.68 reject
Null route using the
ip
command:ip route add blackhole 216.58.212.68/32
Now, if you want to block traffic to a system by name, you can add a fake entry to your hosts file pointing that name to the loopback address:
127.0.0.1 badactor.evil.com
Then any traffic trying to get to that host from your system will be faked out – as long as your system is set to use the hosts file lookup prior to DNS. Any specifically DNS based lookups will still work, although you could use a DNSMASQ server like a Pi Hole to block even DNS lookups.
Make sure you read the man pages for the route
and ip
commands, so you'll understand how to make these commands persistent across reboots if you need them to be.
add a comment |Â
up vote
14
down vote
accepted
up vote
14
down vote
accepted
No. The hosts file doesn't affect any routing. It only affects name lookups. Since 216.58.212.68
is an IP address, the system won't look it up in the hosts table.
Read here for more info on the hosts file: http://manpages.ubuntu.com/manpages/trusty/man5/hosts.5.html
If you want to block connections to an IP address from your system, there are a couple of ways to do that, like:
Blackhole traffic using the
route
command:route add 216.58.212.68 gw 127.0.0.1 lo
Reject traffic using the
route
command:route add -host 216.58.212.68 reject
Null route using the
ip
command:ip route add blackhole 216.58.212.68/32
Now, if you want to block traffic to a system by name, you can add a fake entry to your hosts file pointing that name to the loopback address:
127.0.0.1 badactor.evil.com
Then any traffic trying to get to that host from your system will be faked out – as long as your system is set to use the hosts file lookup prior to DNS. Any specifically DNS based lookups will still work, although you could use a DNSMASQ server like a Pi Hole to block even DNS lookups.
Make sure you read the man pages for the route
and ip
commands, so you'll understand how to make these commands persistent across reboots if you need them to be.
No. The hosts file doesn't affect any routing. It only affects name lookups. Since 216.58.212.68
is an IP address, the system won't look it up in the hosts table.
Read here for more info on the hosts file: http://manpages.ubuntu.com/manpages/trusty/man5/hosts.5.html
If you want to block connections to an IP address from your system, there are a couple of ways to do that, like:
Blackhole traffic using the
route
command:route add 216.58.212.68 gw 127.0.0.1 lo
Reject traffic using the
route
command:route add -host 216.58.212.68 reject
Null route using the
ip
command:ip route add blackhole 216.58.212.68/32
Now, if you want to block traffic to a system by name, you can add a fake entry to your hosts file pointing that name to the loopback address:
127.0.0.1 badactor.evil.com
Then any traffic trying to get to that host from your system will be faked out – as long as your system is set to use the hosts file lookup prior to DNS. Any specifically DNS based lookups will still work, although you could use a DNSMASQ server like a Pi Hole to block even DNS lookups.
Make sure you read the man pages for the route
and ip
commands, so you'll understand how to make these commands persistent across reboots if you need them to be.
edited Aug 13 at 10:00
Anthony Geoghegan
7,21633751
7,21633751
answered Aug 12 at 14:21
Tim Kennedy
13.4k22949
13.4k22949
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f462137%2fubuntu-etc-hosts-addresses-in-the-form%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password