# simple (probably) internet problem

## jyaan

i was going to set up ip masquerading a while back, but found an easier solution for what i was doing and stopped halfway. problem is, when 'undo-ing' what i had done, i somehow messed things up. in order to get the net up after a reboot/shutdown i have to enter the following in a console:

```

route add default gw 10.0.0.2

echo nameserver 10.0.0.2 > /etc/resolv.conf

```

so, how do i make this permanent?

----------

## Hu

What is the output of route ; ifconfig -a ; cat /etc/conf.d/net ; emerge --info?

----------

## jyaan

```

route ; ifconfig -a ; cat /etc/conf.d/net ; emerge --info

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

172.16.195.0    *               255.255.255.0   U     0      0        0 vmnet8

10.0.0.0        *               255.255.255.0   U     0      0        0 eth0

192.168.94.0    *               255.255.255.0   U     0      0        0 vmnet1

link-local      *               255.255.0.0     U     0      0        0 eth0

loopback        *               255.0.0.0       U     0      0        0 lo

default         10.0.0.2        0.0.0.0         UG    0      0        0 eth0

eth0      Link encap:Ethernet  HWaddr 00:01:6C:A6:66:42

          inet addr:10.0.0.5  Bcast:10.0.0.255  Mask:255.255.255.0

          inet6 addr: fe80::201:6cff:fea6:6642/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:233143 errors:0 dropped:0 overruns:0 frame:0

          TX packets:225300 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:184290338 (175.7 Mb)  TX bytes:126045392 (120.2 Mb)

          Interrupt:16 Base address:0xe800

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:10 errors:0 dropped:0 overruns:0 frame:0

          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:648 (648.0 b)  TX bytes:648 (648.0 b)

sit0      Link encap:IPv6-in-IPv4

          NOARP  MTU:1480  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

vmnet1    Link encap:Ethernet  HWaddr 00:50:56:C0:00:01

          inet addr:192.168.94.1  Bcast:192.168.94.255  Mask:255.255.255.0

          inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

vmnet8    Link encap:Ethernet  HWaddr 00:50:56:C0:00:08

          inet addr:172.16.195.1  Bcast:172.16.195.255  Mask:255.255.255.0

          inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

dns_domain_lo="LINUX"

config_eth0=( "dhcp" )

#dhcp_eth0=""Portage 2.1.4.4 (default-linux/x86/2007.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.23-gentoo-r8 i686)

=================================================================

System uname: 2.6.23-gentoo-r8 i686 AMD Sempron(tm)

Timestamp of tree: Mon, 28 Apr 2008 02:30:01 +0000

app-shells/bash:     3.2_p17-r1

dev-java/java-config: 1.3.7, 2.1.4

dev-lang/python:     2.4.4-r9

dev-python/pycrypto: 2.0.1-r6

sys-apps/baselayout: 1.12.11.1

sys-apps/sandbox:    1.2.18.1-r2

sys-devel/autoconf:  2.13, 2.61-r1

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1

sys-devel/binutils:  2.18-r1

sys-devel/gcc-config: 1.4.0-r4

sys-devel/libtool:   1.5.26

virtual/os-headers:  2.6.23-r3

ACCEPT_KEYWORDS="x86"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -march=athlon-xp -pipe"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"

CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"

CXXFLAGS="-O2 -march=athlon-xp -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"

GENTOO_MIRRORS="http://gentoo.osuosl.org/ ftp://ftp.ussg.iu.edu/pub/linux/gentoo http://prometheus.cs.wmich.edu/gentoo http://gentoo.cites.uiuc.edu/pub/gentoo/ "

LANG="en_US.UTF-8"

LC_ALL="en_US.UTF-8"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="3dnow 3dnowext X acl acpi alsa anthy arts bash-completion berkdb bidi cairo cdr cjk cli cracklib crypt cups dbus dri eds emboss esd evo fam firefox foomaticdb fortran gdbm gif gpm gstreamer hal iconv immqt-bc isdnlog joystick jpeg kde kerberos ldap mad midi mikmod mmx mmxext mp3 mpeg mudflap ncurses nls nptl nptlonly nsplugin ogg opengl openmp oss pam pcre pdf perl png ppds pppd python qt3 qt3support qt4 readline reflection sdl session spell spl sse ssl startup-notification svg tcpd tiff timidity truetype unicode vorbis win32codecs x86 xcomposite xml xorg xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="mouse keyboard joystick" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="radeon vesa"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

the extra services are for vmware, though this problem has existed long before i ever used it (so it's unrelated).

----------

## Hu

That looks like your DHCP server is not providing routing/DNS information correctly.  Who operates the DHCP server that issues the 10.x.x.x addresses on your LAN?

----------

## jyaan

i have a router that automatically sets it (zoom adsl x5; horrible interface and difficult to do ANYTHING with), but i didn't change any of the settings on the router. it's always given the 10.0.0.x addresses (no idea why it uses such strange ones), and so it was like that before this issue occurred.

----------

## jyaan

ah, looks like i got lucky; i just found the commands i typed in my bash history (!!). also, i believe the title of the howto was actually ip aliasing, and not masquerading. sigh, ill take this as a lesson and finally research networking (been putting it off for ages).

```
ifconfig eth0 192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0

ifconfig eth0 10.0.0.2 broadcast 192.168.0.255 netmask 255.255.255.0

ifconfig eth0 10.0.0.2 broadcast 10.0.0.2 netmask 255.255.255.0

/etc/init.d/net.eth0 restart

ifconfig eth0 10.0.0.5 broadcast 10.0.0.5 netmask 255.255.255.0

ifconfig eth0 10.0.0.5/24 broadcast 10.0.0.5 netmask 255.255.255.

ifconfig eth0 10.0.0.5 broadcast 10.0.0.5 netmask 255.255.255.0

/etc/init.d/net.eth0 restart

ifconfig eth0 10.0.0.5 broadcast 10.0.0.255 netmask 255.255.255.0

```

 etc..

first line was the example code. first two lines were accidents, but included them just in case they bear any importance (doubt it). after the net.eth0 restart, my internet no longer worked until i did the command listed above(route add default gw 10.0.0.2 ; echo nameserver 10.0.0.2 > /etc/resolv.conf ) and tried a bunch of different ifconfigs. i guess this i just a simple thing, and i need to know which values go where for ifconfig. i recall reading the manpage, but it didn't help me figure things out either.

----------

## jyaan

anybody know what i need to do here? i never did figure it out.

----------

## SeaTiger

Since you are using dhcp, those should be automatic.

Try reboot your machine again, but before you fix the network by hand, do

```
route ; ifconfig -a ; cat /etc/resolv.conf
```

and post the result here.

----------

## jyaan

im starting off from a clean install now. not because of this problem (obviously too minor), but just because i wanted to test some of the latest distro releases and the test the 2008.0 beta.

however, the last install was actually the second one to end up with this same sort of problem problem (the first was actually like that right after the fresh install, but only /etc/resolv.conf was generated incorrectly). 

anyways, route and ifconfig -a were already posted, but i don't recall what resolv.conf said (though it was certainly incorrect). well, hopefully it doesn't occur again, and thanks to everyone that took the time to look into it.

----------

