# 2 Network cards, on different networks

## D0zer

HI All

I am relatively new to Gentoo, I have worked a little bit previously on some gentoo server's at some clients and decided best way to learn more is to setup my own system. I inherited an Old Dell Poweredge 2600 Server. I have installed Gentoo on the machine following the handbook, and the machine is booting up with basic networking in place.

I am able to ping google.com with no issues from the gentoo machine, but I can not ping any machines on the local network via name, only via IP address. I am only able to ping the gentoo machine via ip address not name.

Bellow is my /etc/resolve.conf file

```
# Generated by net-scripts for interface eth0

domain gentoo.mydomain.local

nameserver 192.168.16.1

nameserver 8.8.8.8
```

my /etc/conf.d/net is bellow

```
dns_domain_lo="mydomain.local"

config_eth0="192.168.16.20 netmask 255.255.255.0 brd 192.168.16.255"

routes_eth0="default via 192.168.16.1"

dns_domain_eth0="gentoo.mydomain.local"

dns_servers_eth0="192.168.16.1 8.8.8.8"

mtu_eth0="1450"

config_eth4="10.0.0.80 netmask 255.0.0.0 brd 10.255.255.255"

mtu_eth4="1450"
```

my /etc.conf.d/hostname

```
# Set to the hostname of this machine

hostname="gentoo"

```

I want to use it eventually as a firewall machine between the internet connection and the sbs2003 machine and run things like fetchmail and postfix and the sbs machine will then pop3 the mail from the gentoo machine. The router side of the network is 10.0.0.1 with subnet 255.0.0.0, the inside network on the sbs domain is 192.168.16.1 with subnet 255.255.255.0.

If I try ping 10.0.0.1 from the gentoo machine it says network is unavailable. I am not sure if I need to install additional software on the machine to do nat ect ? Some pointing in the right direction will be a great help.

Many Thanks

Richard

----------

## NeddySeagoon

D0zer,

Welcome to Gentoo.

 *D0zer wrote:*   

> 
> 
> ... but I can not ping any machines on the local network via name, only via IP address

 

You have two options to fix this.  Either run your own dns, to resolve names to IP addresses on your local network, or since you appear to be using static network setups from your

```
config_eth0="192.168.16.20 netmask 255.255.255.0 brd 192.168.16.255" 
```

you can popuate /etc/hosts for the hosts on your 192.168.16.0/24 subnet

An ASCII are sketch of your network would help understanding your network topology.

Sight of the output of the route command would be useful too, this will show how the kernel routes packets.

To install a firewall, follow the Home Router Guide.  Its written as if the system its installed on will only be used for a router but if you treat it as additions, it works just as well.

----------

## rg.viza

 *D0zer wrote:*   

> 
> 
> If I try ping 10.0.0.1 from the gentoo machine it says network is unavailable. I am not sure if I need to install additional software on the machine to do nat ect ? Some pointing in the right direction will be a great help.
> 
> Many Thanks
> ...

 

This could simply mean you are blocking ICMP with a firewall rule and the firewall is running on the wrong interface.

What does (assuming you are using iptables, the OP isn't exactly clear on what you are doing)  *Quote:*   

>  iptables --list 

  and  *Quote:*   

>  ifconfig 

  and

```
 route 
```

 output when run on your firewall box?

When you ping an IP, you remove DNS out of the equation, so the dns info is irrelevant. Your dns setup has _nothing_ to do with how packets get routed or firewalled, outside of pulling the IP for a given hostname.

As well this should really be in the Networking & Security forum, not in the installation forum....

----------

## 666threesixes666

http://lisa-home.sourceforge.net/

samba should do this also with netbios.

(i take it you're trying to resolve windows machine host names)

google: name resolution on LAN using netbios

----------

## desultory

 *rg.viza wrote:*   

> As well this should really be in the Networking & Security forum, not in the installation forum....

 Good call.

Moved from Installing Gentoo to Networking & Security.

----------

## D0zer

Thank's for the feedback everybody. I have done a few changed to my initial Network Setup. Below is the updated config files.

```

# Generated by net-scripts for interface eth4

nameserver 8.8.8.8

nameserver 168.210.2.2

/etc/resolv.conf lines 1-3/3 (END)

```

```

dns_domain_lo="local"

config_eth0="10.0.0.90 netmask 255.0.0.0 brd 10.255.255.255"

routes_eth0="default via 10.0.0.1"

mtu_eth0="1450"

config_eth4="172.16.0.1 netmask 255.255.0.0 brd 172.16.255.255"

dns_servers_eth4="168.210.2.2 8.8.8.8"

mtu_eth4="1450"

/etc/conf.d/net lines 1-13/13 (END)

```

This time I am able to ping from the gentoo console my router at 10.0.0.1 and google.com. I connected another machine directly to eth4 with static IP 172.16.0.2 and am able to ping 172.16.0.1. I am unable to ping 10.0.0.1 or google.com from this machine.

I intend to connect a SBS2003 box to eth4 via static IP. Eventually I want to run Squid, Postfix, Fetchmail, Clam, Amavis on the Gentoo Box and the SBS box will then go through the Gentoo Box.

rg.viza I am using IPtables, started working through the home router guide.

iptables --list Output

```

Chain INPUT (policy ACCEPT)

target     prot opt source               destination

Chain FORWARD (policy ACCEPT)

target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)

target     prot opt source               destination

```

Ifconfig Output

```

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1450

        inet 10.0.0.90  netmask 255.0.0.0  broadcast 10.255.255.255

        inet6 fe80::20f:1fff:fe69:b4df  prefixlen 64  scopeid 0x20<link>

        ether 00:0f:1f:69:b4:df  txqueuelen 1000  (Ethernet)

        RX packets 2348  bytes 230327 (224.9 KiB)

        RX errors 0  dropped 5  overruns 0  frame 0

        TX packets 1445  bytes 185708 (181.3 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth4: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1450

        inet 172.16.0.1  netmask 255.255.0.0  broadcast 172.16.255.255

        ether 00:00:d1:ec:fa:48  txqueuelen 1000  (Ethernet)

        RX packets 1598  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 0  (Local Loopback)

        RX packets 74  bytes 6098 (5.9 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 74  bytes 6098 (5.9 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

Output of route

```

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

default         10.0.0.1        0.0.0.0         UG    2      0        0 eth0

10.0.0.0        *               255.0.0.0       U     0      0        0 eth0

loopback        localhost       255.0.0.0       UG    0      0        0 lo

172.16.0.0      *               255.255.0.0     U     0      0        0 eth4

```

NeddySeagoon Thank you for your suggestion of using the hosts file. I think that is the simplest solution with what I am trying to achieve with this experimental Gentoo System. I don't think I need to worry about running DNS on this machine unless Squid or the other services I want to setup will require it.

Thanks for the link and the google suggestion 666threesixes666, I was trying to resolve windows machine names.

----------

## NeddySeagoon

D0zer,

Your routing table shows no static routes between 172.16.0.0/16 and 10.0.0.0/8

You will therefore need to use NAT from the home router setup or just plain forwarding.

NAT will mangle the packets from 172.16.0.0/16 so that they appear to originate from 10.0.0.90, and unmangle the responses.

Forwarding will do just that.  Your gateway at 10.0.0.1 will see packets from 172.16.0.0/16 (unmangled) and may just drop them as it won't know what to do with them.

Your iptables --list Output  shows that NAT is not set up yet.

----------

## D0zer

Thank's for the reply NeddySeagoon

I ran into some issues with running

```
iptables -t nat -F

iptables v1.4.16.3: can't initialize iptables table `nat': Table does not exist

Perhaps iptables or your kernel needs to be upgraded."
```

I followed the guide http://www.gentoo-wiki.info/HOWTO_Iptables_for_newbies#Installing_iptables and have enabled all the option's this guide suggested in the kernel. I am now recompiling the kernel with the updated option's, hopefully I will be able to run the iptables configs from the Home Router Guide when it finishes.

Regard's

Richard

----------

