Thanesoft can handle your systems administration needs.

Python by a Nose

Posted: December 14th, 2009 | Author: jnials | Filed under: Programming | Tags: , , | No Comments »

Recently I gave a presentation to the Austin Python Users Group.  As usual when doing this sort of presentation, it was a great learning opportunity for me.

My topic was the unit-testing tool Nose for Python.  I spent a lot of time really delving into nose to prepare for the presentation, but as always, when I gave the presentation there were plenty of good questions that I didn’t have answers to that allowed me to expand my knowledge on the fly.

Just as an example, I learned how to split doctests over multiple lines from someone else there.

Regardless, Here is the bundle with the presentation (in PDF format) and the examples if anyone is interested in them.

Blog Traffic Exchange Related Posts
  • blog traffic exchangeWelcome Welcome! This is my new site for both my business as well as technical and business oriented blogging. I'm going to start off by discussing some interesting and not very common ways to do some interesting linux based networking.  I'll be starting off tomorrow with a discussion of the iproute2......
  • blog traffic exchangeIPROUTE2 Tools - Part 1 Linux has a set of IP protocol management tools that are not used very much, but are much more powerful than the tools that are commonly used such as /sbin/ifconfig.  These tools are known as the iproute2 utility suite, and are documented here. This suite was designed to give you......
Blog Traffic Exchange Related Websites
  • You might be a gamer if... You don't think of a Russian bazooka when someone says "RPG". You use game stats to describe things in a movie. (Well, Han just blew his Fast-Talk roll) You use game stats to describe things in real life. You laugh yourself silly when you hear the word "Gazebo". The......
  • Learn French In France Would you like to learn French in France? Then read on which level to choose, which French city you will love and how you prepare yourself best for your French course in France.   In this post you will learn:   how to choose a French course that suits......
  • Affiliate Program versus Affiliate Network - Comparison Have you came across these words Affiliate Program, Affiliate Network ? Don't know what exactly they are, what is the difference ? Then, this articles throws some light for you !!! The term Affiliate, is defined as the system in which one entity associates one or more entities. In......

IPROUTE2 Tools – Part 1

Posted: July 14th, 2009 | Author: jnials | Filed under: Systems Administration | Tags: , , , , , , | No Comments »

Linux has a set of IP protocol management tools that are not used very much, but are much more powerful than the tools that are commonly used such as /sbin/ifconfig.  These tools are known as the iproute2 utility suite, and are documented here.

This suite was designed to give you a more powerful and fine grained interface into managing the details of the IP stack on the linux kernel.  It replaces the ifconfig and route tools and extends the ability of the IP statck to support IP-IP tunnels, GRE Tunnels, policy based routing and can interface directly with iptables based firewalls.

The command suite resembles Cisco configuration commands or other tool suites that take a subject-verb form.  A typical command to see the configuration of an ethernet card might look like this:

$ ip link show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:1a:6b:d0:d5:e9 brd ff:ff:ff:ff:ff:ff
$

It helps to know either the 4-layer TCP/IP network model, or the 7-layer ISO network model.  The commands for these configurations are broken down to fit these models, so for example the command ip link show shows you the commands on the link layer, which is the bottom layer on the TCP/IP model or Layer-2 on the OSI model.

The format of the command is:

ip [options] object [command [arguments]]

where objects inside square brackets are optional.

If there is no command, then the show command is implied.  Other possible commands in are link, address, neighbor, route, rule, maddress, mroute, tunnel. I’ll cover additional commands over the next few posts.  For today, I want to stick with the ones that enable the same functionality as ifconfig, which means we’ll talk about link and address.

As I indicated earlier, ip link deals with showing and setting the link layer characteristics.   These include the such things as the MAC address of the card, MTU, queue sizes and so on. The ip address command  basically sets/configures/deletes the IP address for the card (IPv4 or IPv6).  While the ifconfig command can do much of these things all on one line, there are many things here it cannot do at all as we will see later on.

Let’s run through a sample session configuring a card.   We’ll use the dummy0 device so we don’t hurt anything on the machine we are trying this on.  We’ll do the link layer first and then the IP layer (IP addresses).

#ip link show dummy0
6: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noqueue state DOWN
link/ether 62:8e:3d:e7:5a:54 brd ff:ff:ff:ff:ff:ff

We probably want ARP (Address Resolution Protocol) on:

#ip link set arp on dummy0
#ip link show dummy0
6: dummy0: <BROADCAST> mtu 1500 qdisc noqueue state DOWN
link/ether 62:8e:3d:e7:5a:54 brd ff:ff:ff:ff:ff:ff

And multicast as well:

#ip link set multicast on dummy0
#ip link show dummy0
6: dummy0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN
link/ether 62:8e:3d:e7:5a:54 brd ff:ff:ff:ff:ff:ff

We’ll be going through a router with a smaller MTU so let’s change shrink it down:

#ip link set mtu 1400 dummy0
#ip link show dummy0
6: dummy0: <BROADCAST,MULTICAST> mtu 1400 qdisc noqueue state DOWN
link/ether 62:8e:3d:e7:5a:54 brd ff:ff:ff:ff:ff:ff

And finally lets turn it on:

#ip link set dummy0 up
#ip link show dummy0
6: dummy0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1400 qdisc noqueue state UNKNOWN
link/ether 62:8e:3d:e7:5a:54 brd ff:ff:ff:ff:ff:ff

All that could be replaced by a one liner, but if any command fails, the device could be in an inconsistent state:

#ip link set dummy0 arp on multicast on mtu 1400 up
#ip link show dummy0
6: dummy0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1400 qdisc noqueue state UNKNOWN
link/ether 62:8e:3d:e7:5a:54 brd ff:ff:ff:ff:ff:ff

Now lets add the TCP/IP layer stuff:

#ip addr show dev dummy0
6: dummy0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1400 qdisc noqueue state UNKNOWN
link/ether 62:8e:3d:e7:5a:54 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.1/24 scope global dummy0
inet6 fe80::608e:3dff:fee7:5a54/64 scope link
valid_lft forever preferred_lft forever

#ip addr add 10.0.0.1/24 brd + dev dummy0
#ip addr show dummy0
6: dummy0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1400 qdisc noqueue state UNKNOWN
link/ether 62:8e:3d:e7:5a:54 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.1/24 brd 10.0.0.255 scope global dummy0
inet6 fe80::608e:3dff:fee7:5a54/64 scope link
valid_lft forever preferred_lft forever

Now we can delete it:

#ip addr del 10.0.0.1/24 brd + dev dummy0

#ip addr show dummy0
6: dummy0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1400 qdisc noqueue state UNKNOWN
link/ether 62:8e:3d:e7:5a:54 brd ff:ff:ff:ff:ff:ff
inet6 fe80::608e:3dff:fee7:5a54/64 scope link
valid_lft forever preferred_lft forever

And finally, lets turn it back off so it.

#ip link set dummy0 down
#ip link show dummy0
6: dummy0: <BROADCAST,MULTICAST> mtu 1400 qdisc noqueue state DOWN
link/ether 62:8e:3d:e7:5a:54 brd ff:ff:ff:ff:ff:ff

I’ll have more iproute2 goodness in the next post.

Blog Traffic Exchange Related Websites
  • Save Time, Money and Space in Over 80 Ways If you're looking for handy gadgets, tools and various items that can save you time, money or space (or all three!) this list of more than 80 top products is just what you need. Everyone's got saving money on their minds these days. Some of us are always looking to......
  • Leno And Conan: The Tonight Show Fiasco Are you with Leno or Conan? The Chin or Conando? Cars or Coco? If you’re like me, you like both of these guys for various reasons. You think they’re both talented and funny in their own ways, and would like to see both of them on TV. For me, I......
  • Win Cash! $2,500 Lending Club Giveaway For New Investors My recent article on peer to peer lending mentions that Lending Club is quickly approaching a milestone — they’re about to obtain their 25,000th registered investor! And to mark this momentous occasion, Lending Club is holding a promotion to give away $2,500 to a lucky investor, who’ll happen to......

Welcome

Posted: July 13th, 2009 | Author: jnials | Filed under: Thanesoft | No Comments »

Welcome!

This is my new site for both my business as well as technical and business oriented blogging.

I’m going to start off by discussing some interesting and not very common ways to do some interesting linux based networking.  I’ll be starting off tomorrow with a discussion of the iproute2 tools in Linux.

Please let me know if you find this site useful (or if you want to engage my services!) by sending an email to jnials@thanesoft.com.

Blog Traffic Exchange Related Posts
  • blog traffic exchangeIPROUTE2 Tools - Part 1 Linux has a set of IP protocol management tools that are not used very much, but are much more powerful than the tools that are commonly used such as /sbin/ifconfig.  These tools are known as the iproute2 utility suite, and are documented here. This suite was designed to give you......
  • blog traffic exchangePython by a Nose Recently I gave a presentation to the Austin Python Users Group.  As usual when doing this sort of presentation, it was a great learning opportunity for me. My topic was the unit-testing tool Nose for Python.  I spent a lot of time really delving into nose to prepare for the......
Blog Traffic Exchange Related Websites
  • Blog Shmog By Robert W. Bly If you are on the fence about starting your own corporate blog, this is a great book to read to help you make your decision. The subtitle is “The Truth About Business Blogs” and that pretty much says it all. For those that don’t have time to go through stories......
  • Tips To Promote Your Online Business Using Email Marketing More number of peoples around the world are living with the dream to make profits from their online business venture. Running a successful online business involves taking the right decisions in each stage or level of growth. It also really required to promote your business using the proven marketing strategies.......
  • Should You Use Free Blogging Sites? There are certainly many blogging sites online today. It has become the biggest trend in communications for business and for personal reasons. A blog is a wonderful business tool that allows you to build a presence online as an expert in your field and develop a following of loyal readers.......