# networking

## simonski

hi 

got two pc one is running on gentoo other winxp, thing is i need to acess the net with the xp one, so my gentoo is on the net im using a dhcp connection, is there a way to connect the two pc, i ve tried several things setting up gateway on the gentoo one but realy i ve got no idea what exactly should be done 

help would be great thankx

----------

## NeddySeagoon

simonski,

You need to build iptables into the kernel and run network address translation (NAT) on the gentoo box. That way, you only appear to have a single PC on the internet.

Some firewall tools make it easy(ier). Have a look at Shorewall, it not one I use, so thats not a reccomendaion, just an example.

----------

## simonski

thankx for that sounds very usefull but there are things on my mind concerning the communication between gentoo an xp(wanna change the xp thing also to gentoo but for now i need some kind of solution)

 so with the gentoo comp i wouldn t need to configure my networksettings an could still use iface_eth0=dhcp ,right?- if i use what you were telling me

for eth1 i would have to set up configuration myself an ofcourse eth0 should be defined as gateway, but which code do i typ would 192.168.0.1

be okay, then next thing on my xp client

first ip adress next gateway an next dns sever which i take my providers one- is that all- looks to simple-

please tell me if i m thinkin in the right direction

----------

## simonski

could u tell me more about nat

did emerge search but am not sure which one to take

how will i start it then

do i have to do some rc-update

guess its the last one 

 net-misc/netstat-nat

      Latest version available: 1.4.2

      Latest version installed: [ Not Installed ]

      Size of downloaded files: 15 kB

      Homepage:    http://tweegy.demon.nl/projects/netstat-nat/index.html

      Description: Display NAT connections

      License:     GPL-2

right?

----------

## simonski

ok i really feel stupid asking for everything all the time

but were do i find iptables an how can i build it in

looked at my kernel at networking but didn t see it there

could it be build in as module so that i don t have to recompile

----------

## nobspangle

first off a note on IP addresses

192.168.0.1 is fine for the IP of eth1 on your gentoo box

set your XP box to 192.168.0.2 gateway 192.168.0.1 subnet mask 255.255.255.0 and dns to the same as you use on your gentoo box (look in /etc/resolv.conf)

Then emerge shorewall and read this for instructions on how to set it up. Shorewall will emerge iptables as a dependency

----------

## simonski

hi thanks for that

emerged shorewall and tried to start it but its saying

Loading /usr/share/shorewall/functions...

Processing /etc/shorewall/params ...

Processing /etc/shorewall/shorewall.conf...

Starting Shorewall...

Initializing...

Shorewall has detected the following iptables/netfilter capabilities:

   NAT: Not available

   Packet Mangling: Not available

   Multi-port Match: Not available

   Connection Tracking Match: Not available

Determining Zones...

   Zones: net loc

Validating interfaces file...

Validating hosts file...

Validating Policy file...

Determining Hosts in Zones...

   Warning: Zone net is empty

   Warning: Zone loc is empty

Processing /etc/shorewall/init ...

Deleting user chains...

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': iptables who? (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

Processing /etc/shorewall/stop ...

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': iptables who? (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': iptables who? (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': iptables who? (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': iptables who? (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': iptables who? (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': iptables who? (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': iptables who? (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': iptables who? (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': iptables who? (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

IP Forwarding Enabled

Processing /etc/shorewall/stopped ...

Terminated

had a look at the kernel still no ip_tables there

----------

## megalomani

you need to recompile your kernel and add support for filter modules as 

NAT, .....

see doc on how to change kernel

----------

## simonski

could you be more detailed please where do i add support, in the kernel there is no option to add something like nat or do i just have to compile it and this would be integrated by itsself, means the ip_tables

am a bit confused about that all

----------

## simonski

by the way shorewall seems to be a very powerfullthing,

will take some time to get trough this whole instruction thing

an i m sure it won t work right from start, 

but i think it would be possible to put it at runlevels so that it would start when i start up my pc, right

like rc-update shorewall

guess this not the right one, ha?

----------

## megalomani

type:

cd /usr/src/linux

make menuconfig

add these options as modules or builtin

device drivers

-> Networking support

-> Networking options

-> Network packet filtering

-> IP: Netfilter Configuration

-> * IP tables support

* ... 

make && make modules_install

copy the files

change /etc/lilo.conf

lilo -v

more info se Handbook and https://forums.gentoo.org/viewtopic.php?t=196287&highlight=

----------

## simonski

thanks for

that at least im using 2.2.24

so its a bit different but hope it will work

think this for lilo i don t have to do cause using grub,

ok lets see what comes 

by

----------

## simonski

ahh now i guess i understand what u meant with lilo

u meant to have shorewall there from the beginning, no?

is there a way with grub- there must be an answer to this

other thing if i wanna build up a server, would it be hidden behind shorewall, heard the cable company doesn t allow that  so they are listening on the traffic

----------

## megalomani

no, lilo has nothing to do with iptables. When I started with linux lilo was default choice. And I don't need the add function of grub

Some (not all) internet service provider (ISP) don't allow all types of server on there nets. Mostly because they don't want to relay SPAM, because someone made a full install of a Linux disto and in doing so installed an open SPAM relay.And they don't like to have servers eating upp there bandwidth.

If your ISP doesn't allow for example http servers, you can hide it by change default port. But then you probably violate the conditions, the ISP has for you.

----------

## simonski

hi again

compiled kernel and its more or less the same message

Loading /usr/share/shorewall/functions...

Processing /etc/shorewall/params ...

Processing /etc/shorewall/shorewall.conf...

Starting Shorewall...

Initializing...

Shorewall has detected the following iptables/netfilter capabilities:

   NAT: Not available

   Packet Mangling: Not available

   Multi-port Match: Not available

   Connection Tracking Match: Not available

Determining Zones...

   Zones: net loc

Validating interfaces file...

Validating hosts file...

Validating Policy file...

Determining Hosts in Zones...

   Net Zone: eth0:0.0.0.0/0

   Local Zone: eth1:0.0.0.0/0

Processing /etc/shorewall/init ...

Deleting user chains...

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

Processing /etc/shorewall/stop ...

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

IP Forwarding Enabled

Processing /etc/shorewall/stopped ...

Terminated

maybe i ve to reemerge shorewall but as long its a problem with iptables

how can i emerge them

but i gotta go now+meet friends thanks anyway

have fun simon

----------

## megalomani

It's not a problem with iptables.

You didn't add 

device drivers

-> Networking support

-> Networking options

-> Network packet filtering

-> IP: Netfilter Configuration

-> * IP tables support

* NAT

*packet mangling

*multt-port match

*Connection Tracking

when you recompiled your kernel

----------

## simonski

man you are right completly missed that

ok did it now, but its late here in austria

so go sleepin  :Very Happy: 

----------

## simonski

still not workin

my kernel

```
    <*> Connection tracking (required for masq/NAT)                                      ? ?

  ? ?                           <*>   FTP protocol support                                                           ? ?

  ? ?                           < >   Amanda protocol support                                                        ? ?

  ? ?                           < >   TFTP protocol support                                                          ? ?

  ? ?                           < >   IRC protocol support                                                           ? ?

  ? ?                           < > Userspace queueing via NETLINK (EXPERIMENTAL)                                    ? ?

  ? ?                           <*> IP tables support (required for filtering/masq/NAT)                              ? ?

  ? ?                           < >   limit match support                                                            ? ?

  ? ?                           < >   MAC address match support                                                      ? ?

  ? ?                           < >   Packet type match support                                                      ? ?

  ? ?                           < >   netfilter MARK match support                                                   ? ?

  ? ?                           <*>   Multiple port match support                                                    ? ?

  ? ?                           < >   TOS match support                                                              ? ?

  ? ?                           < >   recent match support                                                           ? ?

  ? ?                           < >   ECN match support                                                              ? ?

  ? ?                           < >   DSCP match support                                                             ? ?

  ? ?                           < >   AH/ESP match support                                                           ? ?

  ? ?                           < >   LENGTH match support                                                           ? ?

  ? ?                           < >   TTL match support                                                              ? ?

  ? ?                           < >   tcpmss match support                                                           ? ?

  ? ?                           < >   Helper match support                                                           ? ?

  ? ?                           < >   Connection state match support                                                 ? ?

  ? ?                           <*>   Connection tracking match support                                              ? ?

  ? ?                           < >   Unclean match support (EXPERIMENTAL)                                           ? ?

  ? ?                           < >   Owner match support (EXPERIMENTAL)                                             ? ?

  ? ?                           < >   Packet filtering                                                               ? ?

  ? ?                           <*>   Full NAT                                                                       ? ?

  ? ?                           < >     MASQUERADE target support                                                    ? ?

  ? ?                           < >     REDIRECT target support                                                      ? ?

  ? ?                           [*]     NAT of local connections (READ HELP)                                         ? ?

  ? ?                           < >     Basic SNMP-ALG support (EXPERIMENTAL)                                        ? ?

  ? ?                           <*>   Packet mangling                                                                ? ?

  ? ?                           < >     TOS target support                                                           ? ?

  ? ?                           < >     ECN target support
```

and output of shorewall start

Loading /usr/share/shorewall/functions...

Processing /etc/shorewall/params ...

Processing /etc/shorewall/shorewall.conf...

Starting Shorewall...

Initializing...

Shorewall has detected the following iptables/netfilter capabilities:

   NAT: Not available

   Packet Mangling: Not available

   Multi-port Match: Not available

   Connection Tracking Match: Not available

Determining Zones...

   Zones: net loc

Validating interfaces file...

Validating hosts file...

Validating Policy file...

Determining Hosts in Zones...

   Net Zone: eth0:0.0.0.0/0

   Local Zone: eth1:0.0.0.0/0

Processing /etc/shorewall/init ...

Deleting user chains...

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist

(do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

Processing /etc/shorewall/stop ...

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist

(do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist

(do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist

(do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist

(do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist

(do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist

(do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist

(do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist

(do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist

(do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

modprobe: Can't locate module ip_tables

iptables v1.2.9: can't initialize iptables table `filter': Table does not exist                                            (do you need to insmod?)

Perhaps iptables or your kernel needs to be upgraded.

IP Forwarding Enabled

Processing /etc/shorewall/stopped ...

Terminated

any idea why  :Evil or Very Mad: 

----------

## megalomani

from https://forums.gentoo.org/viewtopic.php?t=199089&highlight=shorewall

you need to add these for shorewall to work

ipt_TOS

ipt_LOG

ipt_REJECT

ipt_pkttype

ipt_state

ip_nat_irc

ip_nat_tftp

ip_nat_ftp

ip_conntrack_irc

ip_conntrack_tftp

ip_conntrack_ftp

ipt_multiport

ipt_conntrack

iptable_filter

iptable_mangle

iptable_nat

ip_conntrack

ip_tables

----------

## simonski

still not workin

think this is getting pretty long so i ll make up new topic called shorewall iptables problems. ill trie to put all information together ok  :Wink: 

----------

