Repository navigation
Expand file tree
/
Copy pathnetwork.html
More file actions
69 lines (69 loc) · 8.74 KB
/
Copy pathnetwork.html
File metadata and controls
69 lines (69 loc) · 8.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Network - UraniumOS</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header><div class="in"><nav class="l"><a href="index.html">Home</a><a href="download.html">Download</a><a href="docs.html" aria-current="page">Documentation</a><a href="rod.html">Packages</a><a href="news.html">News</a><a href="about.html">About</a></nav><nav class="r"><a href="features.html">Features</a><a href="media.html">Install</a><a href="security.html">Security</a><a href="hardware.html">Hardware</a></nav></div></header>
<main class="in docs">
<aside><div class="sbhead"><a class="sbh" href="index.html">⌂ UraniumOS</a><svg aria-hidden="true" viewBox="-50 -50 100 100"><circle r="48" fill="#f2d21b"/><circle r="6.5" fill="#1b1b19"/><path fill="#1b1b19" d="M6.50 -11.26 A13 13 0 0 0 -6.50 -11.26 L-20.00 -34.64 A40 40 0 0 1 20.00 -34.64 Z M-13.00 -0.00 A13 13 0 0 0 -6.50 11.26 L-20.00 34.64 A40 40 0 0 1 -40.00 -0.00 Z M6.50 11.26 A13 13 0 0 0 13.00 0.00 L40.00 0.00 A40 40 0 0 1 20.00 34.64 Z"/></svg><span class="ver">0.1.1</span><input type="search" placeholder="Search docs" aria-label="Search docs"></div><h4>Read first</h4><ul><li><a href="differences.html">Differences and known failures</a></li></ul><h4>1 Installation</h4><ul><li><a href="download.html">1.1 Download</a></li><li><a href="media.html">1.2 Live medium</a></li><li><a href="partitioning.html">1.3 Partitioning notes</a></li><li><a href="manual-install.html">1.4 Manual install</a></li><li><a href="first-steps.html">1.5 First steps</a></li></ul><h4>2 Configuration</h4><ul><li><a href="users.html">2.1 Users and groups</a></li><li><a href="keyboard.html">2.2 Keyboard</a></li><li><a href="time.html">2.3 Date and time</a></li><li><a href="services.html">2.4 Services</a></li><li><a href="cron.html">2.5 Cron</a></li><li><a href="network.html" aria-current="page">2.6 Network</a></li><li><a href="ssh.html">2.7 SSH</a></li><li><a href="blastdoor.html">2.8 Firewall</a></li><li><a href="desktop.html">2.9 Desktop</a></li><li><a href="firmware.html">2.10 Firmware</a></li><li><a href="boot.html">2.11 Boot</a></li><li><a href="kernel.html">2.12 Kernel</a></li><li><a href="storage.html">2.13 Storage</a></li><li><a href="security.html">2.14 Security</a></li><li><a href="geiger.html">2.15 Health report</a></li></ul><h4>3 Packages</h4><ul><li><a href="rod.html">3.1 rod</a></li><li><a href="cheatsheet.html">3.2 rod cheat sheet</a></li><li><a href="not-in-rod.html">3.3 Package not in rod</a></li><li><a href="recipes.html">3.4 Recipes</a></li><li><a href="silo.html">3.5 Containers</a></li><li><a href="hazmat.html">3.6 Sandboxes</a></li></ul><h4>4 Snapshots</h4><ul><li><a href="scram.html">4.1 scram</a></li><li><a href="backups.html">4.2 Backups</a></li></ul><h4>5 Reference</h4><ul><li><a href="system.html">5.1 System and files</a></li><li><a href="troubleshooting.html">5.2 Troubleshooting</a></li><li><a href="hardware.html">5.3 Hardware status</a></li><li><a href="faq.html">5.4 FAQ</a></li></ul><h4>6 Project</h4><ul><li><a href="developers.html">6.1 Developers</a></li><li><a href="contributing.html">6.2 Contributing</a></li><li><a href="about.html">6.3 About</a></li><li><a href="features.html">6.4 Features</a></li><li><a href="news.html">6.5 News</a></li></ul></aside><article><div class="band"><h1>Network</h1></div>
<p>The network is configured by the <code>dhcp</code> service, which runs busybox <code>udhcpc</code> on the first network device. A static address must be set from <code>/etc/rc.local</code>.</p>
<h2>DHCP</h2>
<p>The <code>run</code> script of <code>dhcp</code> selects the first entry of <code>/sys/class/net/*</code> (in glob order) that has a <code>device</code> directory, which excludes <code>lo</code>, <code>dummy0</code> and <code>sit0</code>. If there is no such entry, the script checks again every second. It then runs <code>ifconfig IF up</code> and <code>exec udhcpc -f -i IF -s /etc/udhcpc.script</code>. Only one interface is configured. A normal start writes this to the log:</p>
<pre><code># cat /var/log/dhcp/current
2026-11-02_16:53:09.65038 udhcpc: started, v1.37.0
2026-11-02_16:53:09.66001 udhcpc: broadcasting discover
2026-11-02_16:53:09.68126 udhcpc: broadcasting select for 10.0.2.15, server 10.0.2.2
2026-11-02_16:53:09.70119 udhcpc: lease of 10.0.2.15 obtained from 10.0.2.2, lease time 86400</code></pre>
<pre><code># ip route
default via 10.0.2.2 dev eth0
10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15
# cat /etc/resolv.conf
nameserver 10.0.2.3</code></pre>
<h2>What the script sets</h2>
<p><code>/etc/udhcpc.script</code> handles two events, <code>bound</code> and <code>renew</code>. On either event the script:</p>
<ul>
<li>(a) runs <code>ifconfig INTERFACE IP netmask SUBNET up</code>, using 255.255.255.0 if the server sent no mask;</li>
<li>(b) adds a default route through the first router that the server sent; and</li>
<li>(c) replaces <code>/etc/resolv.conf</code> with one <code>nameserver</code> line for each DNS server that the server sent.</li>
</ul>
<p>Every other event and option is ignored. Nothing happens on <code>deconfig</code>, a lost or refused lease leaves the old address in place, and domain names, search lists, NTP servers and static routes from the server are dropped. Edits to <code>/etc/resolv.conf</code> are overwritten at the next lease event. The script configures IPv4 only; IPv6 addresses come from router advertisements in the kernel.</p>
<h2>A static address</h2>
<p>To use a static address, remove the link of the service and set the address from <code>/etc/rc.local</code>, which <code>/etc/rc</code> sources at every boot after the firewall and swap setup and before any service starts. The interface name can be found with <code>ip -br link</code>; in QEMU it is <code>eth0</code>.</p>
<pre><code># rm /etc/service/dhcp
# cat >> /etc/rc.local <<'EOF'
ip link set eth0 up
ip addr add 192.168.1.20/24 dev eth0
ip route add default via 192.168.1.1
echo "nameserver 192.168.1.1" > /etc/resolv.conf
EOF</code></pre>
<p>Stopping the service with <code>sv down dhcp</code> is not sufficient, because <a href="geiger.html">geiger</a> then reports it. The link must be removed.</p>
<h2>Hostname</h2>
<p>The hostname is the single line of <code>/etc/hostname</code>, which is applied with <code>hostname -F</code> at boot. <code>setup --hostname NAME</code> writes the file, sets the name at once and writes <code>/etc/hosts</code> as:</p>
<pre><code>127.0.0.1 localhost NAME
::1 localhost</code></pre>
<p>A name is accepted if it consists of 1 to 63 letters, digits and hyphens and neither begins nor ends with a hyphen. <code>hostname NAME</code> changes the running name only, and <code>hostname -F /etc/hostname</code> sets it back. <code>hostname</code> is a busybox applet, so run it as <code>/rod/init/bin/hostname</code>.</p>
<h2>Firewall</h2>
<p>The input policy is drop. The rules accept loopback traffic, replies to outgoing traffic, ICMP and ICMPv6, DHCP replies (UDP source port 67, destination port 68) and new connections to port 22 at a limit of 10 a minute. Forwarding is dropped and output is accepted. <code>blastdoor allow PORT</code> opens further ports; see <a href="blastdoor.html">blastdoor</a>.</p>
<h2>Wired and wireless hardware</h2>
<p>The kernel has no modules, so a driver exists only if it is built in. The kernel of the image is built with these Ethernet drivers: virtio-net, e1000, e1000e, igb, 8139too and r8169. Drivers such as tulip, ixgbe, atlantic, tg3, bnx2 and usbnet are not set. A card that needs a driver that is not built in does not appear in <code>ip link</code>; see <a href="kernel.html">kernel</a>.</p>
<p>Wireless is not supported. The kernel has cfg80211, mac80211 and rfkill built in, but none of the iwlwifi, ath9k, ath10k, rtw88, rtw89, mt76 or brcmfmac drivers, and the base system contains no wireless tool.</p>
<h2>Check a connection</h2>
<pre><code># ip addr
# ip route
# cat /etc/resolv.conf
# ping -c 1 10.0.2.2
# tail /var/log/dhcp/current
# geiger</code></pre>
<p>See <a href="troubleshooting.html">troubleshooting</a>.</p>
<div class="pager"><a href="cron.html">← Cron</a><a href="ssh.html">SSH →</a></div></article>
</main>
<footer><div class="in"><p>Public domain, CC0 1.0</p><p><a href="https://github.com/uranium-os">GitHub</a> <a href="https://texivi.github.io">Blog</a></p></div></footer>
<script>document.querySelectorAll("pre:not(.term):not(.portrait)").forEach(function(p){var b=document.createElement("button");b.textContent="\u29c9";b.title="Copy";b.onclick=function(){navigator.clipboard.writeText(p.innerText.replace(/\u29c9$/,"").trim());b.textContent="\u2713";setTimeout(function(){b.textContent="\u29c9"},900)};p.appendChild(b)});</script>
<script src="docs.js"></script>
<script src="fun.js"></script>
</body>
</html>