the usual blog cleanups

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-10-24 18:08:28 +02:00
parent e0015f4844
commit 82225c0fb2
1 changed files with 27 additions and 18 deletions

View File

@ -2,9 +2,9 @@
## Introduction
This article will explain how to begin to manage a network
with [[sexy|software/sexy]]. I assume you can start almost on a green field,
if not, insert your site specific changes into the process.
This article explains how to begin to manage a network
with [[sexy|software/sexy]]. Because I just moved house,
I take my home network as an example.
## Prerequisites
@ -47,11 +47,7 @@ Now we can network cards to this host:
## Add the network
In sexy, the host and net-ipv4 areas are disconnected: You can use sexy to manage
only hosts, to manage only networks or to manage both. To allow this flexibility,
the network part does not know about any information from the host part.
Luckily enough, you don't need to re-enter the information, but you can retrieve
them from the database. Currently, sexy only allows you to manage IPv4 based networks
Currently, sexy only allows you to manage IPv4 based networks
- IPv6 may be added in future releases. So the command to remember for now, is
**net-ipv4**:
@ -63,6 +59,12 @@ Now we created the network 192.168.24.0/22.
## Add a host to a network
In sexy, the host and net-ipv4 areas are disconnected: You can use sexy to manage
only hosts, to manage only networks or to manage both. To allow this flexibility,
the network part does not know about any information from the host part.
Luckily enough, you don't need to re-enter the information, but you can retrieve
them from the database.
The previously added host, **katze.intern.schottelius.org**, is the router of
my home network and it should use the first IPv4 address in the network.
The **net-ipv4 host-add** command can be used to add a host:
@ -91,15 +93,15 @@ the network, it used .1:
Sexy does not know which DNS or DHCP server you may be using.
To implement changes to your architecture (probably using
a software like [[cdist|software/cdist]]), sexy supports using
**backends**.
a software like [[cdist|software/cdist]]), sexy supports
**backends** to do the change.
For my home network, I am going to use
[dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html), because the
router is a small [Soekris net5501](http://soekris.com/net5501.htm).
The backends are stored in **~/.sexy/backend** and for this
example tutorial, I will only create **~/.sexy/backend/net-ipv4/apply**:
example tutorial, I will create **~/.sexy/backend/net-ipv4/apply**:
% cat ~/.sexy/backend/net-ipv4/apply
#!/bin/sh -e
@ -126,20 +128,21 @@ example tutorial, I will only create **~/.sexy/backend/net-ipv4/apply**:
done
mv "${tmp}" "${dstfile}"
eof
done
cd "${dst_dir}"
git add .
git commit -m "Update Sexy generated network configuration" -o -- .
git commit -m "Update Sexy generated network configuration" -o -- . 2>/dev/null || true
echo "Transferring changes to git remote"
git pull
git push
git pull --quiet
git push --quiet
"$cdist_bin" config -v zuhause.schottelius.org
This backend in essence creates the dnsmasq configuration and executes cdist afterwards
to apply the changes.
In essence this backend creates the dnsmasq configuration and executes cdist afterwards
to apply the changes. I personally prefer a backend to be shell script, but it can be
any kind of executable.
## Adding more hosts
@ -154,9 +157,15 @@ server, I'll add my notebook and the fileserver to sexy:
% sexy net-ipv4 host-add -m $(sexy host nic-addr-get -n nic0 brief.intern.schottelius.org) -f brief.intern.schottelius.org 192.168.24.0
As you can see, if I do not specify the name of the nic, sexy automatically uses **nic0**
for the first nic and counts up. This decision was made, as network device names vary between
for the first nic. This decision was made, as network device names vary between
operating systems and even operating system versions.
## Applying the configuration
The previously created backend will get executed with all existing networks,
if you run the apply command with the **--all** parameter:
% sexy net-ipv4 apply --all
## The result