- 论坛徽章:
- 0
|
本帖最后由 tqyou85 于 2018-08-02 15:45 编辑
想启动netconsole将本地主机的内核日志 打印到远程主机上。
本地主机:
1. 修改/etc/sysconfig/netconsole文件
- # This is the configuration file for the netconsole service. By starting
- # this service you allow a remote syslog daemon to record console output
- # from this system.
- # The local port number that the netconsole module will use
- LOCALPORT=6666
- # The ethernet device to send console messages out of (only set this if it
- # can't be automatically determined)
- # DEV=
- # The IP address of the remote syslog server to send messages to
- SYSLOGADDR=172.16.118.118
- # The listening port of the remote syslog daemon
- SYSLOGPORT=22222
- # The MAC address of the remote syslog server (only set this if it can't
- # be automatically determined)
- # SYSLOGMACADDR=
复制代码
2. 启动netconsole(前提是netconsole已经编译进内核)
/etc/init.d/netconsole start
启动之后dmesg查看有如下信息
- [ 2183.363726] netpoll: netconsole: local port 6666
- [ 2183.363730] netpoll: netconsole: local IPv4 address 172.16.118.101
- [ 2183.363732] netpoll: netconsole: interface 'eth0'
- [ 2183.363733] netpoll: netconsole: remote port 22222
- [ 2183.363735] netpoll: netconsole: remote IPv4 address 172.16.118.118
- [ 2183.363737] netpoll: netconsole: remote ethernet address 00:0c:29:38:8a:35
- [ 2183.363762] console [netcon0] enabled
- [ 2183.363764] netconsole: network logging started
复制代码
3. 加载自己写的helloworld模块,dmesg查看内核有打印
- [ 4278.590553] hello, world!
- [ 4280.590391] hello, world!
- [ 4282.590218] hello, world!
- [ 4284.590041] hello, world!
复制代码
远程主机
执行命令nc -u -l -p 22222
执行完成后,应该能看到“hello, world!”吧?但是现状是什么都没看到。。。
两台主机的防火墙都是关闭的。fedora操作系统,内核版本:3.11.10-301.fc20.i686+PAE
在远程主机上用tcpdump抓包,没有抓到端口22222的udp包
请大侠帮忙看看是怎么回事?
|
|