diff options
Diffstat (limited to 'source/n/network-scripts/scripts')
-rw-r--r-- | source/n/network-scripts/scripts/netconfig | 51 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/rc.inet1 | 32 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/rc.inet1.conf | 10 | ||||
-rw-r--r-- | source/n/network-scripts/scripts/rc.inet2 | 2 |
4 files changed, 85 insertions, 10 deletions
diff --git a/source/n/network-scripts/scripts/netconfig b/source/n/network-scripts/scripts/netconfig index 04afd698..1e115148 100644 --- a/source/n/network-scripts/scripts/netconfig +++ b/source/n/network-scripts/scripts/netconfig @@ -69,6 +69,16 @@ GATEWAY="$GATEWAY" # when rc.inet1 is called directly. DEBUG_ETH_UP="no" +# Example of how to configure a bridge: +# Note the added "BRNICS" variable which contains a space-separated list +# of the physical network interfaces you want to add to the bridge. +#IFNAME[0]="br0" +#BRNICS[0]="eth0" +#IPADDR[0]="192.168.0.1" +#NETMASK[0]="255.255.255.0" +#USE_DHCP[0]="" +#DHCP_HOSTNAME[0]="" + ## Example config information for wlan0. Uncomment the lines you need and fill ## in your info. (You may not need all of these for your wireless network) #IFNAME[4]="wlan0" @@ -309,9 +319,14 @@ EOF fi done +# Write the hostname with domain to /etc/HOSTNAME: echo $HOSTNM.$DOMAIN > etc/HOSTNAME +# Also make sure the hostname is written to /etc/NetworkManager/NetworkManager.conf: +if [ -w etc/NetworkManager/NetworkManager.conf ]; then + sed -i "s/^hostname=.*$/hostname=$HOSTNM/g" etc/NetworkManager/NetworkManager.conf +fi -dialog --title "SETUP IP ADDRESS FOR '$HOSTNM.$DOMAIN'" \ +dialog --title "CONFIGUATION TYPE FOR '$HOSTNM.$DOMAIN'" \ --default-item DHCP \ --menu \ "Now we need to know how your machine connects to the network.\n\ @@ -319,14 +334,14 @@ If you have an internal network card and an assigned IP address, gateway, \ and DNS, use the 'static IP' choice to enter these values. If your IP \ address is assigned by a DHCP server (commonly used by cable modem and DSL \ services), select 'DHCP'. If you do not have a network card, select \ -the 'loopback' choice. 'loopback' is also the correct choice if your \ -only connection to the network will be through a serial modem \ -(with SLIP or PPP), or if you are using a laptop network card (these \ -are configured in /etc/pcmcia/). What type of network connection \ -best describes your machine?" 20 70 3 \ +the 'loopback' choice. You may also select 'NetworkManager' if you would \ +like to have the NetworkManager daemon automatically handle your wired and \ +wireless network interfaces (this is simple and usually works). \ +Which type of network setup would you like?" 20 70 4 \ "static IP" "Use a static IP address to configure ethernet" \ "DHCP" "Use a DHCP server to configure ethernet" \ -"loopback" "Set up a loopback connection (modem or no net)" 2> $TMP/reply +"loopback" "Set up a loopback connection (modem or no net)" \ +"NetworkManager" "Autoconfigure network using NetworkManager" 2> $TMP/reply if [ $? = 1 -o $? = 255 ]; then rm -f $TMP/reply exit @@ -348,6 +363,9 @@ below. If you do not have a DHCP hostname, just hit ENTER or Cancel." 13 62 \ DHCP_HOSTNAME="$NEW_DHCPHOST" elif [ "$REPLY" = "loopback" ]; then LOOPBACK="yes" +elif [ "$REPLY" = "NetworkManager" ]; then + LOOPBACK="yes" + NETWORKMANAGER="yes" else LOOPBACK="no" fi @@ -554,7 +572,7 @@ You'll have to try to configure the card later by editing \ fi fi -if [ "$LOOPBACK" = "yes" ]; then +if [ "$LOOPBACK" = "yes" -a ! "$NETWORKMANAGER" = "yes" ]; then dialog --title "NETWORK SETUP COMPLETE" --yesno "Your networking \ system is now configured to use loopback: @@ -563,6 +581,15 @@ Netmask: 255.255.255.0 Is this correct? Press 'Yes' to continue, or 'No' to reconfigure." 0 0 RETVAL=$? +elif [ "$LOOPBACK" = "yes" -a "$NETWORKMANAGER" = "yes" ]; then + dialog --title "NETWORK SETUP COMPLETE" --yesno "Your networking \ +system is now configured to use NetworkManager for +wired and wireless network management. To set up wireless networks +and view status, add the Network Management control panel widget to +your KDE desktop. + +Is this correct? Press 'Yes' to confirm, or 'No' to reconfigure." 0 0 + RETVAL=$? elif [ "$USE_DHCP" = "" ]; then while [ 0 ]; do dialog --title "CONFIRM NETWORK SETUP" \ @@ -617,8 +644,16 @@ Is this correct? Press 'Yes' to continue, or 'No' to reconfigure." 0 0 fi if [ "$RETVAL" = "0" ]; then + # Write the hostname with domain to /etc/HOSTNAME: echo $HOSTNM.$DOMAIN > etc/HOSTNAME + # Also make sure the hostname is written to /etc/NetworkManager/NetworkManager.conf: + if [ -w etc/NetworkManager/NetworkManager.conf ]; then + sed -i "s/^hostname=.*$/hostname=$HOSTNM/g" etc/NetworkManager/NetworkManager.conf + fi write_config_files + if [ "$NETWORKMANAGER" = "yes" -a -r etc/rc.d/rc.networkmanager ]; then + chmod 755 etc/rc.d/rc.networkmanager + fi if [ "$1" = "" ]; then dialog --msgbox "Settings accepted. Basic network configuration is complete." 6 40 fi diff --git a/source/n/network-scripts/scripts/rc.inet1 b/source/n/network-scripts/scripts/rc.inet1 index 4e6c7aa0..dc325f47 100644 --- a/source/n/network-scripts/scripts/rc.inet1 +++ b/source/n/network-scripts/scripts/rc.inet1 @@ -72,6 +72,29 @@ lo_down() { # INTERFACE FUNCTIONS # ####################### +# Function to assemble a bridge interface. +br_open() { + # argument is 'i' - the position of this interface in the IFNAME array. + /sbin/brctl addbr ${IFNAME[$1]} + for BRIF in $(echo ${BRNICS[$1]}); do + /sbin/ifconfig $BRIF down + /sbin/ifconfig $BRIF 0.0.0.0 promisc up + /sbin/brctl addif ${IFNAME[$1]} $BRIF + done +} + +# Function to disassemble a bridge interface. +br_close() { + # argument is 'i' - the position of this interface in the IFNAME array. + #for BRIF in $(echo ${BRNICS[$1]}); do + for BRIF in $(ls --indicator-style=none /sys/class/net/${IFNAME[$1]}/brif/) + do + /sbin/brctl delif ${IFNAME[$1]} $BRIF + done + /sbin/ifconfig ${IFNAME[$1]} down + /sbin/brctl delbr ${IFNAME[$1]} +} + # Function to bring up a network interface. If the interface is # already up or does not yet exist (perhaps because the kernel driver # is not loaded yet), do nothing. @@ -82,6 +105,8 @@ if_up() { [ "${IFNAME[$i]}" = "${1}" ] && break i=$(($i+1)) done + # If the interface is a bridge, then create it first: + [ -n "${BRNICS[$i]}" ] && br_open $i # If the interface isn't in the kernel yet (but there's an alias for it in # modules.conf), then it should be loaded first: if ! grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # no interface yet @@ -92,7 +117,7 @@ if_up() { fi if grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # interface exists if ! /sbin/ifconfig | grep -w "${1}" 1>/dev/null || \ - ! /sbin/ifconfig ${1} | grep "inet addr" 1> /dev/null ; then # interface not up or not configured + ! /sbin/ifconfig ${1} | grep -w inet 1> /dev/null ; then # interface not up or not configured if [ ! "${HWADDR[$i]}" = "" ]; then # Set hardware address _before_ the interface goes up: echo "/etc/rc.d/rc.inet1: /sbin/ifconfig ${1} hw ether ${HWADDR[$i]}" | $LOGGER /sbin/ifconfig ${1} hw ether ${HWADDR[$i]} @@ -105,6 +130,9 @@ if_up() { . /etc/rc.d/rc.wireless ${1} start # Initialize any wireless parameters fi if [ "${USE_DHCP[$i]}" = "yes" ]; then # use DHCP to bring interface up + # Clear DHCP_OPTIONS before adding new options to it: + unset DHCP_OPTIONS + # Set DHCP_OPTIONS for this interface: [ ${DHCP_HOSTNAME[$i]} ] && DHCP_OPTIONS="-h ${DHCP_HOSTNAME[$i]}" [ "${DHCP_KEEPRESOLV[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -C resolv.conf" [ "${DHCP_KEEPNTP[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -C ntp.conf" @@ -179,6 +207,8 @@ if_down() { if [ -x /etc/rc.d/rc.wireless ]; then . /etc/rc.d/rc.wireless ${1} stop # Kill wireless daemons if any. fi + # If the interface is a bridge, then destroy it now: + [ -n "${BRNICS[$i]}" ] && br_close $i fi } diff --git a/source/n/network-scripts/scripts/rc.inet1.conf b/source/n/network-scripts/scripts/rc.inet1.conf index 555210c4..d3798d8b 100644 --- a/source/n/network-scripts/scripts/rc.inet1.conf +++ b/source/n/network-scripts/scripts/rc.inet1.conf @@ -45,6 +45,16 @@ GATEWAY="" # when rc.inet1 is called directly. DEBUG_ETH_UP="no" +# Example of how to configure a bridge: +# Note the added "BRNICS" variable which contains a space-separated list +# of the physical network interfaces you want to add to the bridge. +#IFNAME[0]="br0" +#BRNICS[0]="eth0" +#IPADDR[0]="192.168.0.1" +#NETMASK[0]="255.255.255.0" +#USE_DHCP[0]="" +#DHCP_HOSTNAME[0]="" + ## Example config information for wlan0. Uncomment the lines you need and fill ## in your data. (You may not need all of these for your wireless network) #IFNAME[4]="wlan0" diff --git a/source/n/network-scripts/scripts/rc.inet2 b/source/n/network-scripts/scripts/rc.inet2 index 232d93ec..4f51a330 100644 --- a/source/n/network-scripts/scripts/rc.inet2 +++ b/source/n/network-scripts/scripts/rc.inet2 @@ -98,7 +98,7 @@ fi # Start NIS (the Network Information Service): if [ -x /etc/rc.d/rc.yp ]; then - . /etc/rc.d/rc.yp start + /etc/rc.d/rc.yp start fi # Start the NFS server. Note that for this to work correctly, you'll |