func (r *CommandRunner) SendDHCPRequest(intfName, hostname string) error {
	if _, err := r.ExecCommand(false, "udhcpc", "-i", intfName, "-x", fmt.Sprintf("hostname:%s", hostname)); err != nil {
		return err
	}
	log.Infof("Send DHCP request on interface %s with hostname %s.", intfName, hostname)
	return nil
}
SendDHCPRequest sends a DHCP request for a certain network interface with the hostname in parameter.
package syscmd
import (
	"fmt"
	"strconv"
	"strings"
	log "github.com/golang/glog"
)
func (r *CommandRunner) CreateVLAN(intfName string, vlanID int) (string, error) {
	vlanINTFName := vlanINTFName(intfName, vlanID)
	log.Infof("Creating VLAN interface %v...", vlanINTFName)
	if _, err := r.ExecCommand(true, "ip", "link", "add", "link", intfName, "name", vlanINTFName, "type", "vlan", "id", strconv.Itoa(vlanID)); err != nil {
		return "", err
	}
	log.Infof("Created VLAN interface %v.", vlanINTFName)
	return vlanINTFName, nil
}
func (r *CommandRunner) DeleteVLAN(intfName string, vlanID int) error {
	vlanINTFName := vlanINTFName(intfName, vlanID)
	log.Infof("Deleting VLAN interface %v...", vlanINTFName)
	if _, err := r.ExecCommand(true, "ip", "link", "delete", vlanINTFName); err != nil {
		return err
	}
	log.Infof("Deleted VLAN interface %v.", vlanINTFName)
	return nil
}
func (r *CommandRunner) RestartIntf(intfName string) error {
	log.Infof("Restarting interface %v...", intfName)
	if err := r.TurnDownIntf(intfName); err != nil {
		return err
	}
	if err := r.BringUpIntf(intfName); err != nil {
		return err
	}
	log.Infof("Restarted the interface %v.", intfName)
	return nil
}
func (r *CommandRunner) BringUpIntf(intfName string) error {
	if _, err := r.ExecCommand(true, "ifconfig", intfName, "up"); err != nil {
		return err
	}
	log.Infof("Interface %v is UP.", intfName)
	return nil
}
func (r *CommandRunner) TurnDownIntf(intfName string) error {
	if _, err := r.ExecCommand(true, "ifconfig", intfName, "down"); err != nil {
		return err
	}
	log.Infof("Interface %v is DOWN.", intfName)
	return nil
}
func (r *CommandRunner) WipeOutIntfIP(intfName string) error {
	if _, err := r.ExecCommand(true, "ifconfig", intfName, "0.0.0.0"); err != nil {
		return err
	}
	log.Infof("Wiped out the IP on interface %v.", intfName)
	return nil
}
func (r *CommandRunner) IntfMAC(intfName string) (string, error) {
	mac, err := r.ExecCommand(true, "cat", fmt.Sprintf("/sys/class/net/%s/address", intfName))
	if err != nil {
		return "", err
	}
	mac = mac[0 : len(mac)-1]  
	log.Infof("MAC address of %v is %v.", intfName, mac)
	return mac, nil
}
func (r *CommandRunner) VLANOnIntf(intfName string) ([]int, error) {
	linkInfo, err := r.ExecCommand(true, "ip", "-o", "-d", "link", "show")
	if err != nil {
		return nil, err
	}
	vlanIDs := vlanIDsInIPLinkResult(intfName, linkInfo)
	log.Infof("Interface %s has VLAN %v.", intfName, vlanIDs)
	return vlanIDs, nil
}
func vlanIDsInIPLinkResult(intfName, linkInfo string) []int {
	var vlanIDs []int
	for _, intfInfo := range strings.Split(linkInfo, "\n") {
		if !strings.Contains(intfInfo, fmt.Sprintf("@%s", intfName)) || !strings.Contains(intfInfo, "vlan") {
			continue
		}
		for _, infoElem := range strings.Split(intfInfo, "\\") {
			if !strings.Contains(infoElem, "vlan") {
				continue
			}
			foundID := false
			for _, vlanInfoElem := range strings.Fields(infoElem) {
				if foundID {
					if vlanID, err := strconv.Atoi(vlanInfoElem); err == nil {
						vlanIDs = append(vlanIDs, vlanID)
					}
					break
				}
				if vlanInfoElem == "id" {
					foundID = true
				}
			}
		}
	}
	return vlanIDs
}
func (r *CommandRunner) UpdateIntfMAC(intfName, updatedMAC string) error {
	if _, err := r.ExecCommand(true, "ifconfig", intfName, "hw", "ether", updatedMAC); err != nil {
		return err
	}
	log.Infof("The MAC address of %v updated to %v.", intfName, updatedMAC)
	return nil
}