Building a Transparent Firewall with Linux, Part III
Listing 3. New /etc/config/network File
config 'switch' 'eth0' option 'enable' '1' config 'switch_vlan' 'eth0_0' option 'device' 'eth0' option 'vlan' '0' option 'ports' '0 1 2 3 4 5' config 'interface' 'loopback' option 'ifname' 'lo' option 'proto' 'static' option 'ipaddr' '127.0.0.1' option 'netmask' '255.0.0.0' config 'interface' 'lan' option 'type' 'bridge' option 'ifname' 'eth0.0' option 'proto' 'static' option 'ipaddr' '10.0.0.253' option 'netmask' '255.255.255.0'
Listing 4 shows the seven commands necessary to transform /etc/config/network, as shown in Listing 2, into that shown in Listing 3. Before executing these, however, please read the explanatory text that follows, which will help you avoid the risk of bricking (rendering useless) your broadband router.
Listing 4. uci Commands to Change /etc/config/network
root@OpenWrt:~# uci set network.eth0_0.ports="0 1 2 3 4 5" root@OpenWrt:~# uci delete network.eth0_1 root@OpenWrt:~# uci set network.lan.ipaddr="10.0.0.253" root@OpenWrt:~# uci delete network.wan root@OpenWrt:~# uci show network root@OpenWrt:~# uci commit root@OpenWrt:~# reboot
I'm out of space for this month, so I can't dissect Listing 4, which is hopefully similar enough to the previous uci examples to make sense. I will, however, leave you with two important notes.
First, note the uci show network. This allows you to check your work before committing changes. If any line is wrong, you can re-enter the relevant uci command. To start over, enter the command uci revert network to undo all changes. If you mess things up so badly you can't ssh back in, you can re-flash the firmware image, which among other things will reset the router's IP address back to 192.168.1.1. Checking and rechecking your work before committing, however, is less work and easier on your nerves than re-flashing!
Second, after changing your device's IP address and rebooting, you won't be able to reconnect to your OpenWrt box until you've reconfigured your client system with an IP address compatible with the OpenWrt box's new address. For example, after I reconfigured my Linux laptop's Ethernet interface with the IP address 10.0.0.30 and netmask 255.255.255.0, I was able to ssh back in to my OpenWrt router with the command ssh email@example.com.
I've covered a lot of ground this month: recompiling OpenWrt for iptables bridging support, enabling SSH, using uci and reconfiguring networking. Next time, I'll show you how to disable the default OpenWrt firewall and create a custom iptables script that should work on any bridging-aware Linux 2.6 system. Until then, be safe!
Home Page for the OpenWrt Project: www.openwrt.org
OpenWrt's Unified Configuration Interface Documentation: wiki.openwrt.org/doc/uci
Chart of Time Zone Strings: nuwiki.openwrt.org/oldwiki/openwrtdocs/whiterussian/configuration#timezone
OpenWrt Software Package Information: wiki.openwrt.org/oldwiki/openwrtdocs/packages
Mick Bauer (firstname.lastname@example.org) is Network Security Architect for one of the US's largest banks. He is the author of the O'Reilly book Linux Server Security, 2nd edition (formerly called Building Secure Servers With Linux), an occasional presenter at information security conferences and composer of the “Network Engineering Polka”.
|Dynamic DNS—an Object Lesson in Problem Solving||May 21, 2013|
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
|Non-Linux FOSS: Seashore||May 10, 2013|
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- New Products
- RSS Feeds
- Dart: a New Web Programming Experience
- Resources for “Analysis of the HTB Queuing Discipline”
- Parallel Programming with NVIDIA CUDA
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Developer Poll
59 min 40 sec ago
- Keeping track of IP address
2 hours 50 min ago
- Roll your own dynamic dns
8 hours 4 min ago
- Please correct the URL for Salt Stack's web site
11 hours 15 min ago
- Android is Linux -- why no better inter-operation
13 hours 30 min ago
- Connecting Android device to desktop Linux via USB
13 hours 59 min ago
- Find new cell phone and tablet pc
14 hours 57 min ago
16 hours 26 min ago
- Automatically updating Guest Additions
17 hours 34 min ago
- I like your topic on android
18 hours 21 min ago
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?