Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
configuration suggestion
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ecks
n00b
n00b


Joined: 27 Feb 2007
Posts: 64

PostPosted: Fri Apr 13, 2007 9:32 pm    Post subject: configuration suggestion Reply with quote

I need some advice on what I need to configure for my situation. I have a laptop and a home computer, and my home computer has two NICs. My network at school won't let me use two computers for one ethernet plug, and does not allow routers or anything else. I know that I can make it possible to connect my laptop through my computer to the internet, and have been trying to set up iptables for the past couple of weeks. Do I really need iptables for this? Can I enable some option to add a route so that anything incoming from nic1 can outgo to nic2 and vice versa, with no kind of filtering. Will I be able to achieve this by tunneling? Since I use one interface for dhcp, will it be possible to do this:
config_eth0=("dhcp")
config_eth1=( "192.168.1.1/24" )
routes_eth0=( "default via eth0" )
Please let me know what other options I have available besides iptables?
Back to top
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1611
Location: U.S.A.

PostPosted: Sat Apr 14, 2007 12:54 am    Post subject: Reply with quote

http://www.gentoo.org/doc/en/home-router-howto.xml
Back to top
View user's profile Send private message
ecks
n00b
n00b


Joined: 27 Feb 2007
Posts: 64

PostPosted: Mon Apr 16, 2007 6:09 pm    Post subject: Reply with quote

I finally got iptables working by reinstalling everything from scratch and using genkernel rather than the manual one. I had to similarly enable the same options, but this time as modules, and it finally worked, now I have iptables working. Since I would like to have my laptop setup through DHCP, i installed dnsmasq on my comp and that worked too. Since I just wanted to see if everything is working after all this time, I decided to not muddle for now with the iptables syntax and install firestarter. That worked pretty well, however I could still not get DNS, it worked only if I input the IP address of google.com in a browser. For some reason, even though dnsmasq is supposed to provide a DNS server, it doesnt for me. I simply pointed my DNS server to be the one that I get DNS for my server, and that worked fine. Once I setup iptables through firestarter, i figure I can just unmerge it and save the current iptables configuration. Well, when I came back the next day, I turned on my laptop and couldn't get an ip address. After reinstalling dnsmasq, and restarting firestarter, I finally turned iptables off, and it worked fine. I guess that means that something is wrong with iptables, it blocks off dhcp requests after it is turned on. Here is the iptables generated by firestarter:
Code:
# Generated by iptables-save v1.3.5 on Mon Apr 16 18:06:25 2007
*mangle
:PREROUTING ACCEPT [5809:2325925]
:INPUT ACCEPT [4750:2168816]
:FORWARD ACCEPT [15047:11467588]
:OUTPUT ACCEPT [2274:226287]
:POSTROUTING ACCEPT [2437:283976]
COMMIT
# Completed on Mon Apr 16 18:06:25 2007
# Generated by iptables-save v1.3.5 on Mon Apr 16 18:06:25 2007
*nat
:PREROUTING ACCEPT [2601:432255]
:POSTROUTING ACCEPT [8:480]
:OUTPUT ACCEPT [62:3611]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Mon Apr 16 18:06:25 2007
# Generated by iptables-save v1.3.5 on Mon Apr 16 18:06:25 2007
*filter
:INPUT DROP [16:6736]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
:INBOUND - [0:0]
:LOG_FILTER - [0:0]
:LSI - [0:0]
:LSO - [0:0]
:OUTBOUND - [0:0]
-A INPUT -s 150.250.1.1 -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT
-A INPUT -s 150.250.1.1 -p udp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p icmp -m limit --limit 10/sec -j ACCEPT
-A INPUT -d 255.255.255.255 -i eth0 -j DROP
-A INPUT -d 150.250.197.255 -j DROP
-A INPUT -s 224.0.0.0/255.0.0.0 -j DROP
-A INPUT -d 224.0.0.0/255.0.0.0 -j DROP
-A INPUT -s 255.255.255.255 -j DROP
-A INPUT -d 0.0.0.0 -j DROP
-A INPUT -m state --state INVALID -j DROP
-A INPUT -f -m limit --limit 10/min -j LSI
-A INPUT -i eth0 -j INBOUND
-A INPUT -d 192.168.0.1 -i eth1 -j INBOUND
-A INPUT -d 150.250.197.96 -i eth1 -j INBOUND
-A INPUT -d 192.168.0.255 -i eth1 -j INBOUND
-A INPUT -j LOG_FILTER
-A FORWARD -p icmp -m limit --limit 10/sec -j ACCEPT
-A FORWARD -i eth1 -j OUTBOUND
-A FORWARD -d 192.168.0.0/255.255.255.0 -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -d 192.168.0.0/255.255.255.0 -p udp -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -j LOG_FILTER
-A OUTPUT -s 150.250.197.96 -d 150.250.1.1 -p tcp -m tcp --dport 53 -j ACCEPT
-A OUTPUT -s 150.250.197.96 -d 150.250.1.1 -p udp -m udp --dport 53 -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -s 224.0.0.0/255.0.0.0 -j DROP
-A OUTPUT -d 224.0.0.0/255.0.0.0 -j DROP
-A OUTPUT -s 255.255.255.255 -j DROP
-A OUTPUT -d 0.0.0.0 -j DROP
-A OUTPUT -m state --state INVALID -j DROP
-A OUTPUT -o eth0 -j OUTBOUND
-A OUTPUT -o eth1 -j OUTBOUND
-A OUTPUT -j LOG_FILTER
-A INBOUND -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INBOUND -p udp -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INBOUND -j LSI
-A LSI -j LOG_FILTER
-A LSI -j DROP
-A LSO -j LOG_FILTER
-A OUTBOUND -p icmp -j ACCEPT
-A OUTBOUND -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTBOUND -p udp -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTBOUND -j ACCEPT
COMMIT
# Completed on Mon Apr 16 18:06:25 2007


Would I have to start all over from scratch or can I just modify one or two rules to enable DHCP and DNS through? By the way, this has been a really long work in progress, but I hope it is finally coming to a close. I did learn alot from it though :)

EDIT: I did try using the home router link posted above, but it didnt work for some reason as well. Also, SSH seems to be not working as well.
Back to top
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1611
Location: U.S.A.

PostPosted: Tue Apr 17, 2007 1:44 am    Post subject: Reply with quote

Yes, you should be able to.

It's been a long time since I messed with iptables. As I recall, there are other firewall utilities that might be more suited to router configuration than firestarter, although probably few as user-friendly. You should also check your kernel configuration and /etc/sysctl to make sure you do not have any of the networking functionality disabled that is needed for your desktop to function as a router.

Since your "LAN" only consists of one computer, it might be easier and more efficient to use a static IP address. If your laptop has a utility to store and switch between multiple "locations" (network configurations), you can store that static IP address and also the dns information.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum