Quote:
Originally posted by tekbuz
I just got the broadband and i like to make a home network. The think is i was planing to do by two network card but when ever i set from interfaces i lost internet connection. in eth0 with auto dhcp broadband working fine. Can anyone tell me how am i gonna connect the other computers. Thanks!
|
The file
/etc/network/interfaces is where your settings for the card are it should contain something like this for it to work and this assumes that you have the cable from the second card in the machine eth1 going into a hub/switch/router that the other machines on the network are connecting into.
Code:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# The first network card - this entry was created during the Debian installation
# (network, broadcast and gateway are optional)
auto eth0 eth1
iface eth0 inet dhcp
iface eth1 inet static
address 192.168.0.254
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
Now you need an iptables script to do the forwarding/firewalling for the machines I use
Arno's IPTABLES you download the script to the machine and set it up as follows.
1. Copy the rc.iptables to /etc/init.d/ directory and change the permissions
chmod 0700 /etc/init.d/rc.iptables.
2. Create the link to start the script on boot I used
update-rc.d rc.iptables defaults or you can use the recommended
ln -s /etc/init.d/rc.iptables /etc/rcS.d/S99iptables in the help/installation instructions at the site both start the script on boot.
3. Now you copy the configuration file to /etc/iptables-firewall.conf and change the settings for your setup. In this section change the EXT_IF_DHCP_IP=0 to EXT_IF_DHCP_IP=1 to tell it you get the address with DHCP.
Code:
IPTABLES="/sbin/iptables" # Location of the iptables-binary (use 'locate
iptables' or 'whereis iptables'
# to manually locate it).
EXT_IF="eth0" # The external interface that will be protecte
d (and used as internet connection)
# This is probably ppp+ for (A)DSL (for non-tr
ansparent (A)DSL routers!)
# otherwise it should be "ethX" (ex. eth0)
EXT_IF_DHCP_IP=0 # Enable if THIS machines (dynamically) obtain
s its IP through DHCP (from your ISP)
And here you change the internal interface to the static settings using these settings which allows you to use IP's for the machines on your network in the ranges 192.168.0.1-192.168.0.253 .
Code:
#####################################
# LAN & NAT (masquerading) settings #
#####################################
INT_IF="eth1" # Internal network interface or interfaces (mu
ltiple(!) interfaces should be
# space seperated). Remark this if you don't h
ave any internal network interfaces.
INTERNAL_NET="192.168.0.0/24" # Your internal subnet which is connected to t
he internal interface (INT_IF. For
# multiple interfaces(!) you can either specif
y multiple subnets here or specify one
# big subnet for all internal interfaces. Note
that packets from these subnets are always
# accepted!
NAT=1 # Enable this if you want to perform NAT for y
our internal network (LAN)
# (ie, share your internet connection with you
r internal net(s) connected to INT_IF)
The NAT=1 as the comments tell you allow you to share the connection.
4. Now you change the permissions again so only root can see the settings file
chmod 0600 /etc/iptables-firewall.conf .
5.Restart the networking so you can set the IP for eth1
/etc/init.d/networking restart and start the firewall/NAT so you can use the connection sharing
/etc/init.d/rc.iptables start.
Now the machines on your internal network use settings like this to enable them to connect to the network.
Code:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# The first network card - this entry was created during the Debian installation
# (network, broadcast and gateway are optional)
auto eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.254
And you would need to set the nameservers in the /etc/resolv.conf.
Code:
search wolf
nameserver 192.168.1.10
nameserver 192.168.1.34
You only need the one nameserver line the search of your domain is optional depending on your ISP's settings that they gave you and the extra nameserver is not necessary but good to have in case your primary goes down.
BTW if you want to use IRC then change in the General settings of the config file
USE_IRC=0 to
USE_IRC=1.