Configure port to be used as serial port when booting



  • I have two serial ports:

    [2.3.4-RELEASE][admin@pfSense.localdomain]/root: ls /dev/cua*
    /dev/cuau2      /dev/cuau2.lock /dev/cuau3.init
    /dev/cuau2.init /dev/cuau3      /dev/cuau3.lock
    [2.3.4-RELEASE][admin@pfSense.localdomain]/root:

    I'd like to boot using serial port, so that I can connect to pfsense, using another pc via serial port

    where to choose the serial port to use to boot?


  • Netgate

    Look at the bottom of System > Advanced.



  • it doesn't allow me to select the port the use

    which file should I edit?


  • Netgate

    So use the port it chooses? Are they both available to connect to?

    https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/serialconsole-setup.html



  • I don't understand one thing:
    which port pfsense use as default?
    both ports available?
    I don't understand if the cable I have doen't work, if serial port doesn't work, or if pfsense doesn't work via serial port…..


  • Netgate

    Sounds like you have some diagnostic work to do. Certainly would require a crystal ball from here with the information presented.

    You are asking about something few people have done. I cannot even test it because none of my pfSense nodes have VGA or serial ports other than designated console ports that are not typical UARTs at boot time.

    Netgate ADI units have a special community edition built for them that changes the console to what most people would call COM2. You can see the logic here for what it places in the /boot/loader.conf file. The RCC stuff at the end is for the ADI units. Those who have been around a while know that the standard address/port for COM1 is 0x3F8 and COM2 is 0x2F8:

    
    if ($serial_only === true) {
    		$data[] = 'boot_serial="YES"';
    		$data[] = 'console="comconsole"';
    	} elseif ($vga_only === true) {
    		$data[] = 'console="vidconsole"';
    	} elseif (is_serial_enabled()) {
    		$data[] = 'boot_multicons="YES"';
    		$data[] = 'boot_serial="YES"';
    		$primaryconsole = isset($g['primaryconsole_force']) ?
    		    $g['primaryconsole_force'] :
    		    $config['system']['primaryconsole'];
    		switch ($primaryconsole) {
    			case "video":
    				$data[] = 'console="vidconsole,comconsole"';
    				break;
    			case "serial":
    			default:
    				$data[] = 'console="comconsole,vidconsole"';
    		}
    	}
    	$data[] = 'comconsole_speed="' . $serialspeed . '"';
    	if ($specific_platform['name'] == 'RCC-VE' ||
    	    $specific_platform['name'] == 'RCC' ||
    	    $specific_platform['name'] == 'RCC-DFF') {
    		$data[] = 'comconsole_port="0x2F8"';
    		$data[] = 'hint.uart.0.flags="0x00"';
    		$data[] = 'hint.uart.1.flags="0x10"';
    	}
    
    

    You might try placing similar items that match what you need on your hardware in /boot/loader.conf.local

    Something like this for COM2:

    boot_multicons="YES"
    boot_serial="YES"
    console="comconsole,vidconsole"
    comconsole_speed="115200"
    comconsole_port="0x2F8"

    Looking at /var/run/dmesg.boot should show you what COM/UART ports are where.

    uart0: <16550 or compatible> at port 0x3f8-0x3ff irq 4 on isa0
    uart1: <16550 or compatible> at port 0x2f8-0x2ff irq 3 flags 0x10 on isa0
    uart1: console (115200,n,8,1)



  • please indicate me with type of nullmodem cable I have to buy
    there are a lot of configuration: https://en.wikipedia.org/wiki/Null_modem

    please indicate which do I need to buy to connect pfsense machine to a linux machine

    thanks


  • Netgate

    Impossible without knowing what ports you have on your "linux machine" and your router.

    If you have no idea how to use a serial console why are you so hell-bent on using one?

    FWIW I generally use these and connect my USB serial adapter directly to it:

    https://www.amazon.com/Bargain-Cable-Female-Modem-Adapter/dp/7507825604/



  • update:

    the cable I have seems to be ok
    I have tested it connecting another pfsense machine via serial to the other pc

    so, the second pc is ok, the cable is ok, the problem is pfsense that doesn't send data to serial port

    tomorrow I'll do other tests

    Impossible without knowing what ports you have on your "linux machine" and your router.

    serial ports on pci card and integrated serial port


  • Netgate

    sigh.