WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [SOLVED]Questions about the /etc/hosts file  (Read 2489 times)

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
[SOLVED]Questions about the /etc/hosts file
« on: March 25, 2013, 12:10:23 PM »
Hi all

I need to modify (add to) my hosts file but according to the wiki, the /etc folder is not persistent between boots.
Not a problem as I can create a script that appends to it at boot time.

However I see that the hosts file is a mix of ipv4 and ipv6 stuff, can I add ipv4 stuff at the end of the hosts file?
For example my hosts file looks something like this:

Code: [Select]
127.0.0.1 box localhost

# The following lines are desirable for IPv6 capable hosts
# (added automatically by netbase upgrade)

::1  ip6-localhost ip6-loopback
then a bunch of IPv6 related lines.

Can I append to the end of the file with lines like this:

Code: [Select]
0.0.0.0 SomePeskyAdServer.com
0.0.0.0 AnotherAdServer.net

Thanks.
« Last Edit: March 25, 2013, 12:41:56 PM by Paulo »

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Re: Questions about the /etc/hosts file
« Reply #1 on: March 25, 2013, 12:38:31 PM »
OK, tried it out and works like a charm  ;)

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: [SOLVED]Questions about the /etc/hosts file
« Reply #2 on: March 25, 2013, 12:56:54 PM »
My hosts file happens to be 500Kb+ in size and 15000 lines+ in length.

Storing it on same partition as persistent tcedir and symlinking it to /etc/hosts, while including the symlink in backup works fine for me.

Before symlinking I had prepended the content of default /etc/hosts to my personal file.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline Paulo

  • Full Member
  • ***
  • Posts: 139
Re: [SOLVED]Questions about the /etc/hosts file
« Reply #3 on: March 25, 2013, 01:10:37 PM »
Hi tinypoodle

Quote
My hosts file happens to be 500Kb+ in size and 15000 lines+ in length.

Wow, you must really hate adverts  :)

Seriously, symlinking is a good idea.
Thanks.