Iptables in slackware
Hi there,
I'm facing a problem with iptables. I'm new in network configuration in linux and I want to set up two networks. I have a LAN at home and at School and I want to be able to change my networks when I'm at school/home. I'm told that it can be done with iptables but I'm not quite sure if it's possible ? Particularly I want to do something like this: Code:
eth0 Link encap:Ethernet HWaddr 00:03:0D:0D:4D:32 I hope you understood me.. If somebody could give me some information about how it can be done and what am I supposed to know to do it. I want to do some reading ( I don't expect someone just tell me the commands :) ) P.S. I'm sorry for the wrong forum category... Could someone please move my topic to Networking ? Thanks in advance! Best wishes, tftd |
Actually I am not sure what you are actually trying to do.
Iptables is used mainly for security reason, or if you want to build a router/firewall out of a linux machine. It can be configured with a specific rule, to drop, alter or pass the properties (like IP address, port etc.) of certain IP Packets based on certain criteria from or out of your machine. And these are done mainly for security reason, for example like NAT (Network Address Translation) feature in a firewall. If you want to change your machine IP address based on the location where you at, then may be iptables is not what you are looking for. I would think that you probably should be looking into dhcp or someway to manipulate your rc.inet1 while it is booting up. Anyway here is some links that I found good on iptables: http://www.linuxguruz.com/iptables/howto/ - A MUST read http://www.justlinux.com/nhf/Securit...es_Basics.html |
alpha hack
I'm trying to learn networking so when I looked at your example on eth1 I'm confused as to it's output. You have a masked the last 8 bits of a number but it shows a broadcast of 192.168.1.255 and IP address of 192.168.0.123 so it would not be on the same network as I understand it. Like I stated "I'm learning" so maybe I don't understand what your asking. |
Hi there,
I'm actually tying to make 2 different networks and switch them. Like on windows, you can create different networks, enable and disable them. I am sure it's possible on linux but don't know how and what I'm exactly looking for... So sorry if I am asking stupid questions :P Best wishes, tftd |
If you get your network address using DHCP protocol, then just rerun rc.inet1 each time. You can find it in /etc/rc.d
|
Quote:
|
So you need to write a script which swaps rc.inet1.conf
|
Quote:
Ok then, what documentation will I need to read to do that ? |
Open rc.inet1.conf and all settings are explained there.
Basically, you need the scripts which do something similar to: Code:
mv /etc/rc.d/rc.inet1.conf /etc/rc.d/rc.inet1.conf.school Code:
mv /etc/rc.d/rc.inet1.conf /etc/rc.d/rc.inet1.home |
Personally, I'd just serve dhcp in my home network too and be done with it. Problem solved.
Alternatively, you could create a short script to use ifconfig(8) and route(8) to manually configure your network. See /etc/rc.d/rc.inet1 for examples of how to use those two commands. |
Ok,
Thanks a lot for the valuable information you gave me ! Best wishes, tftd |
Hi, I do have the same problem before. But I was using RHEL that time, and I need to travel to different places, e.g. home, office, client side. And I feel tired to edit the network configuration file everytime. So I wrote my own shellscript to help me do this job. And then everytime when I am at a different place I just select the proper option from there.
Anyway, you don't need to be a experienced shellscript guru to do that, if you have time, go to this site: http://www.linuxcommand.org/writing_shell_scripts.php |
All times are GMT -5. The time now is 02:04 AM. |